查看微信文档 剪贴板API:https://developers.weixin.qq.com/miniprogram/dev/api/wx.setClipboardData.html https://developers.weixin.qq.com/miniprogram/dev/api/wx.getClipboardData.html 分别是设置/获取复制的内容
栗子:
<button catchtap='copy'>复制文字</button>
copy: function(e) {
var that = this;
var text = that.data.text
wx.setClipboardData({
data: text,
success: function(res) {
wx.getClipboardData({
success: function(res) {
console.log('复制内容为', res.data)
}
})
},
})
},