wxml
<view class='page'>
<!-- 标签名称 -->
<view class='conents_lab'>
<label class='shop_left'>{{order_name}}
<text selectable='true' bindlongtap='copy'>{{order_ids}}</text>
</label>
</view>
<!-- 复制 -->
<label class='lab_copy' bindtap='copyBtn'>复制</label>
</view>
js
Page({
/**
* 页面的初始数据
*/
data: {
order_name: "订单编号:",
order_ids: "21435643645765867879"
},
// 一键复制事件
copyBtn: function(e) {
var that = this;
wx.setClipboardData({
//准备复制的数据
data: that.data.order_name + that.data.order_ids,
success: function(res) {
wx.showToast({
title: '复制成功',
});
}
});
},
})