index.wxml
<view class="card_text sub" bindtap="onCallPhoneTap" data-name="12345678911">手机:12345678911</view> <view class="card_text" catchtap='onCopyTap' data-name="12345678911">微信:12345678911</view> <view class="card_text sub" catchtap='onCopyTap' data-name="12345678911"><text style='margin-right:14rpx;'>QQ</text>:12345678911</view> <view class="card_text">地址:火星</view>
点击触发绑定事件onCallPhoneTap~拨打电话/onCopyTap 剪切板
index.js
/** * 拨打电话 */ onCallPhoneTap: function (e) { const dataset = e.currentTarget.dataset, value = dataset.name; console.log(e) wx.makePhoneCall({ // phoneNumber: this.data.tel, phoneNumber: value, }); }, /** * 复制信息 */ onCopyTap: function (e) { const dataset = e.currentTarget.dataset, value = dataset.name; wx.setClipboardData({ data: value, success: function (res) { wx.showToast({ title: '复制成功!' }); } }); },注:绑定信息数据在 e.currentTarget.dataset 中,data-name对应为e.currentTarget.dataset.name,即可获取