废话不多说,直接上代码
复制文本
<view bindtap='copyText' wx:if="{{qiye.email.length>0}}" data-text="{{qiye.email}}">邮箱:{{qiye.email}}</view>
Page({
data: {
qiye: []
},
copyText: function (e) {
var text = e.currentTarget.dataset.text;
if (text == '') {
wx.showToast({
title: "主人并未留下邮箱",
icon: 'none',
duration: 2000
});
return;
}
wx.setClipboardData({
data: text,
success: function (res) {
wx.getClipboardData({
success: function (res) {
wx.showToast({
title: '复制成功'
})
}
})
}
})
},
})
拨打电话
<view catchtap="freeTell" wx:if="{{qiye.contactNum.length>0}}">电话:{{qiye.contactNum}}</view>
Page({
data: {
qiye: []
},
freeTell: function () {
wx.makePhoneCall({
phoneNumber: this.data.qiye.contactNum,
}).catch((e) => {})
},
})