The vue project uses vue-clipboard2 to implement the function of the clipboard
1. Install the vue-clipboard2 plugin: cnpm install --save vue-clipboard2
2. Add main.js
import VueClipboard from 'vue-clipboard2'
Vue.use(VueClipboard)
3. Copy component: message binding text to be copied/onCopy copy success callback/onError copy failure callback
v-clipboard:copy="message"
v-clipboard:success="onCopy"
v-clipboard:error="onError"