需求:复制运单编号
方法:wx.setClipboardData
<view class="prize" wx:for="{{ prizeList }}" wx:key="id">
......
<view class="copy" bindtap="copy" data-title="{{ item.waybillNumber }}" wx:if="{{ item.waybillNumber }}">复制</view>
</view>
// 复制
copy(e) {
let query = e.currentTarget.dataset['title'];
console.log(query);
wx.setClipboardData({
data: query,
success: function (res) {
wx.showToast({
title: '复制成功',
icon: 'none',
mask: 'true'
})
}
})
}
网友评论