小程序?qū)崿F(xiàn)點(diǎn)擊復(fù)制鏈接或者文本功能要怎么做
1、wxml
<view class="erweima" bindtap="open" data-text="82889999-3394"></view >
2艘蹋、js
open(e){
console.log(e.currentTarget.dataset.text);
wx.setClipboardData({//復(fù)制文本
data: e.currentTarget.dataset.text,
success: function (res) {
wx.getClipboardData({//獲取復(fù)制文本
success: function (res) {
wx.showToast({
title: '復(fù)制成功',
icon:"none",//是否需要icon
mask:"true"http://是否設(shè)置點(diǎn)擊蒙版锄贼,防止點(diǎn)擊穿透
})
}
})
}
})
},
在這里插入圖片描述
就可以了
新建了個(gè)群,歡迎大家一起進(jìn)群討論459358760