利用插件实现复制粘贴功能
全局安装vue-clipboard2
npm install --save vue-clipboard2
在main.js中引入使用
import VueClipboard from 'vue-clipboard2';
Vue.use(VueClipboard)
<view class="account_box">
<view class="account_center" v-for="(item,index) in accountMsg" :key='index' :class="{'bottom_active':index==2 }">
<text>{{item.name}}</text>
<text>{{item.msg}}</text>
<van-button block v-clipboard:copyhttplist="item.msg" v-clipboard:success="onCopy">复制</van-button>
</view>
</view>
// 复制
onCopy(e) {
console.log(e)
this.$notify({ type: 'success', message: '复制成功' });
},
copymessage: function (e) {
},
copyhttplist: function (e) {
},