wxml
<view class="cv" bindtap="copyText" data-title="{{item.code}}">复制</view>
js
copyText(e) { console.log(e); let that = this; wx.setClipboardData({ //复制文本 data:e.currentTarget.dataset.title,//要复制的文本内容 success: function (res) { wx.showToast({ title: '复制成功', icon: "none", mask: "true" //是否设置点击蒙版,防止点击穿透 }) } }) },