僅供參考
1,wxml:
<view bindlongtap="phoneNumTap">{{phoneNum}}</view>
2,js:
data = { phoneNum: '123456789014' } methods = { // 長按號碼響應函數 phoneNumTap: function() { var that = this; // 提示呼叫號碼還是將號碼添加到手機通訊錄 wx.showActionSheet({ itemList: ['呼叫', '添加聯系人'], success: function(res) { if(res.tapIndex === 0) { // 呼叫號碼 wx.makePhoneCall({ phoneNumber: that.data.phoneNum, }) } else if(res.tapIndex == 1) { // 添加到手機通訊錄 wx.addPhoneContact({ firstName: '張三', //聯系人姓名 mobilePhoneNumber: that.data.phoneNum, //聯系人手機號 }) } } }) }, }
.