<template>
<div>
<p>{{message}}</p>
<button type="button" @click="doCopy(我是复制内容)">Copy</button>
</div>
</template>
<script>
export default {
data () {
return {
message: ''
}
},
methods: {
dataProcessing (val) {
this.message += ' ' + val
},
doCopy: function (val) {
this.dataProcessing(val)
this.$copyText(this.message).then(function (e) {
alert(e.text)
}, function (e) {
alert('复制失败', e.text)
})
}
}
}
</script>
vue一键复制
最新推荐文章于 2023-07-12 21:16:20 发布