微信小程序唤起手机拨号功能

点击页面拨打电话,会调出手机拨号键盘,显示相应的想要拨打的电话,调用微信小程序接口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("拨号失败!")
      }
    })
  },
})
发布了31 篇原创文章 · 获赞 5 · 访问量 785

猜你喜欢

转载自blog.csdn.net/weixin_45899022/article/details/103520159