vue & this.$copyText
<p>{{message2}}</p>
<button type="button" @click="doCopy('add me!')">Copy!</button>
dataProcessing (val) {
this.message2 = this.message2 + ' ' + val
},
doCopy: function (val) {
this.dataProcessing(val)
this.$copyText(this.message2).then(function (e) {
console.log(e)
alert('Copied='+ e.text)
}, function (e) {
alert('Can not copy',e.text)
console.log(e)
})
}
methods: {
handleCopyLink (link) {
this.$copyText(link).then((e) => {
this.$message.success('复制成功!');
}, (e) => {
this.$message.error('复制失败!');
});
},
handleClose () {
this.$emit('close');
}
}