本文實例講述了微信小程序實現的一鍵撥號功能。分享給大家供大家參考,具體如下:
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
希望本文所述對大家微信小程序開發有所幫助。
新聞熱點
疑難解答