微信小程序点击复制源码
<view class='center_name_copy ' bindtap='copyBtn'>点击复制 </view> </view>
.center_name_copy {
width: 160rpx;
height: 50rpx;
border-radius: 10px;
color:#E51C23 ;
font-size: 24rpx;
text-align: center;
font-family: Microsoft Yahei;
border: 1px solid #E51C23 ;
line-height: 50rpx;}
//点击复制
copyBtn: function(e) {
var that = this;
wx.setClipboardData({
data: that.data.num,
success: function(res) {
wx.showToast({
title: '复制成功',
});
}
});
},