wxml:
<text bindtap="copyText" data-key="{{item.cdkey}}">{{ item.cdkey }}</text>
js:
copyText(e) {
let key = e.currentTarget.dataset.key;
wx.setClipboardData({
data: key,
success(res) {
console.log(res, key);
wx.getClipboardData({
success(res) {
wx.showToast({
title: '复制成功',
})
}
})
}
})
}