index.wxml里代码如下

<button bindtap="open">点击拨号</button>

只需要添加一个触发按钮即可

然后index.js里添加一个函数

open: function () {
    wx.showActionSheet({
      itemList: ['400-900-2250'],
      success: function (res) {
        console.log(res) //当点击400-900-2250就相当于点击了
        wx.makePhoneCall({
          phoneNumber: '400-900-2250', //此号码并非真实电话号码,仅用于测试  
          success: function () {
            console.log("拨打电话成功!")
          },
          fail: function () {
            console.log("拨打电话失败!")
          }
        })
        if (!res.cancel) {
          console.log(res.tapIndex)//console出了下标
        }
      }
    });
  }

然后就可以,有问题的话可以留言提问哦

相关文章:

  • 2022-01-03
  • 2022-12-23
  • 2021-12-26
  • 2022-12-23
  • 2021-08-07
  • 2021-12-26
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-10-09
  • 2021-11-02
  • 2021-09-25
  • 2021-04-18
相关资源
相似解决方案