<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>