实现功能如下:
1 .wxml里写一个复制按钮
<button bindtap="copy"> 一键复制 </button>2 .js里写复制功能
copy: function (e) {
var that = this;
wx.setClipboardData({
data: "这里为复制的内容",
success: function (res) {
wx.showModal({
title: '提示',
content: '复制成功',
success: function (res) {
if (res.confirm) {
console.log('确定')
} else if (res.cancel) {
console.log('取消')
}
}
})
}
});
},
