vue复制粘贴文本,打开链接
点击图标,复制链接,打开链接。页面上
<i class="el-icon-document-copy" style="margin-left: 20px" title="点击复制链接" @click="textCopy(url)"/>
<i class="el-icon-link" style="margin-left: 5px" title="点击打开原链接" @click="openUrl(url)"/>
方法里面
methods: {
//粘贴板复制
textCopy(text){
var that =this;
this.$copyText(text).then(function (e) {
// console.log('复制成功',e.text)
that.$message.success("复制成功")
}, function (e) {
that.$message.error(err)
})
},
//浏览器打开链接
openUrl(url){
window.open(url,'_blank');
}
}