本文实例讲述了微信小程序实现的一键拨号功能。分享给大家供大家参考,具体如下:
1. 在.wxml文件中绑定拨号事件
<button type="default" bindtap="calling">拨打电话</button>
2. 在.js文件中加入逻辑代码
calling: function () {
wx.makePhoneCall({
phoneNumber: '***************',
success: function () {
console.log("拨打电话成功!")
},
fail: function () {
console.log("拨打电话失败!")
}
})
}
3. 效果图
关于wx.makePhoneCall更多详细说明还可参考官网说明:https://developers.weixin.qq.com/miniprogram/dev/api/wx.makePhoneCall.html
希望本文所述对大家微信小程序开发有所帮助。