wxml
<view class="bodyer-wechatid">
<view>{{expert.wechatid}}</view>
<image class="wachat" data-wechatid="{{expert.wechatid}}" bindtap="copywxtap" src="../../images/wachat.svg"></image>
</view>
js
copywxtap: function (event) {
var wxChat=event.currentTarget.dataset.wechatid; //接收wxml传过来的数据
wx.showToast({
title: '复制成功',
})
wx.setClipboardData({
data: wxChat,
success: function (res) {
wx.getClipboardData({
success: function (res) {
console.log(res.data)
}
})
}
})
},