微信小程序点击跳转打电话功能

wx.makePhoneCall

属性 类型 默认值 必填 说明
phoneNumber string 需要拨打的电话号码
success function 接口调用成功的回调函数
fail function 接口调用失败的回调函数
complete function 接口调用结束的回调函数(调用成功、失败都会执行)
html 复制代码
<view class="f16 mt20 flex align_center" wx:if="{{item.telephone}}">
    联系电话:<text>{{item.telephone?item.telephone:''}}</text>
    <van-icon wx:if="{{item.telephone}}" data-item="{{item}}" bind:tap="callPhone" name="phone" color="#00d59e" style="margin-left:20rpx" size="25" />
</view>
javascript 复制代码
 callPhone(event) { //拨打电话
    var item = event.currentTarget.dataset.item;
    wx.showModal({
      title: '提示',
      content: '是否拨打' + item.telephone,
      success: (res) => {
        if (res.confirm) {
          wx.makePhoneCall({
            phoneNumber: item.telephone,
          })
        }
      }
    })
  },
相关推荐
蜗牛前端1 小时前
codex 全流程开发上线的高颜值礼簿小程序
前端·微信小程序
爱勇宝4 天前
我想认真做一件小事:让孩子和家长更好地互动
微信小程序·小程序·云开发
唯火锅不可辜负4 天前
避坑指南:iOS 下 scroll-view 嵌套 fixed 布局的“翻车”现场与修复
微信小程序
didiplus4 天前
运维人的随身神器:我把25个常用工具塞进了微信小程序
微信小程序
一份执念5 天前
uni-app 小程序分包限制处理与主包体积优化实战
前端·微信小程序
一份执念5 天前
ECharts 安装与使用完全指南:从全量引入到小程序分包优化
微信小程序·echarts
skiyee6 天前
🔥UniApp 仅需 5 行代码!实现所有页面中控制应用主题变化
前端·微信小程序
Jinkey7 天前
要用户手机号真的是为了打骚扰电话吗?浅谈微信生态会员账号体系与资产合并
后端·微信·微信小程序
用户4324281061149 天前
微信小程序从0到1接入微信支付的完整攻略
微信小程序
spmcor11 天前
微信小程序 setStorageSync 踩坑实录:别让"顺手一存"变成"隐形炸弹"
微信小程序