官網(wǎng):點擊跳轉(zhuǎn)
安裝
npm install --save vue-clipboard2
引入(我一般在main.js引入吹截,如果僅僅是某一小模塊用到,在對應(yīng)的component引入即可)
import Vue from 'vue'
import VueClipboard from 'vue-clipboard2'
Vue.use(VueClipboard)
3特纤、使用
// js
let message = '拷貝的文本';
this.$copyText(message).then(res => {
alert('Copied');
}).catch(err => {
alert('Can not copy');
})