<input @paste="pasting">
pasting(e) {
// console.log(e.clipboardData.files[0])
if (e.clipboardData.files[0]) {//获取剪切板图片
this.$http.Imgupload(e.clipboardData.files[0]).then(res => {
let imgtaghtml = '<img src="' + this.$baseURL + res.data.msg.path + '" style="width:80px;height:80px;"/>'
})
}
// else{
// }
},
<p v-html="message" @click="getdetail"></p>
假设message里有多个img标签,getdetail可以获取被点击的img对象
v-text有显示标签
v-html会解析标签
最后
以上就是灵巧大地最近收集整理的关于vue input监听粘贴事件获取图片的全部内容,更多相关vue内容请搜索靠谱客的其他文章。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复