微信小程序 --长按复制、点击复制实现
微信小程序 --长按复制、点击复制简单实现
·
长按复制
<text selectable="true" user-select='true'>长按复制:{{address_id}}</text>
点击复制
wxml
<view bindtap="copying" data-txt='{{item.txt}}'>点击复制:{{item.txt}}</view>
js
copying (e) {
var txt= e.currentTarget.dataset.txt;
wx.setClipboardData({
data: txt,
success: function (res) {
wx.showToast({
title: '已复制',
icon: 'none', //没有图标
duration: 2000 //持续的时间
})
}
});
},
更多推荐
所有评论(0)