訂單號:<text selectable='true' bindlongtap='copy' >{{OrderModel.OrderNo}}</text><button bindtap="copyBtn">一鍵複製</button></view>
長按複製 js:
/**
* 長按複製
*/
copy: function (e) {
var that = this;
console.log(e);
wx.setClipboardData({
data: that.data.OrderModel.OrderNo,
success: function (res) {
wx.showToast({
title: '複製成功',
});
}
});
},
一鍵複製 js:
/**
* 一鍵複製
*/
copyBtn: function (e) {
var that = this;
wx.setClipboardData({
data: that.data.OrderModel.OrderNo,
success: function (res) {
wx.showToast({
title: '複製成功',
});
}
});
},