点击页面拨打电话,会调出手机拨号键盘,显示相应的想要拨打的电话,调用微信小程序接口wx.makePhoneCall便可实现
wxml:
<button type="default" bindtap="Tel" data-tel="{{tel}}">拨打电话:{{tel}}</button>
js:
Page({
data: {
tel:"1576647153"
},
Tel: function (e) {
var tel = e.currentTarget.dataset.tel;
wx.makePhoneCall({
phoneNumber: tel,
success: function () {
console.log("拨号成功!")
},
fail: function () {
console.log("拨号失败!")
}
})
},
})