微信小程序实现直接拨打电话功能

原创
2018/04/03 10:42
阅读数 2.9K

一、微信小程序实现拨打电话功能

微信小程序》API》设备》拨打电话

js接口 wx.makePhoneCall(OBJECT) ,用于实现拨打电话功能

OBJECT参数说明:

参数 类型 必填 说明
phoneNumber String 需要拨打的电话号码
success Function 接口调用成功的回调
fail Function 接口调用失败的回调函数
complete Function 接口调用结束的回调函数(调用成功、失败都会执行)

 

二、使用示例:

wxml:

  <view class="weui-cell weui-cell_access" hover-class="weui-cell_active" bindtap='call'>
    <view class="weui-cell__hd">
      <view class='fa fa-phone'></view>
    </view>
    <view class="weui-cell__bd">{{phone}}</view>
    <view class="weui-cell__ft weui-cell__ft_in-access"></view>
  </view>

js:

//拨打电话事件
call:function(){
  wx.makePhoneCall({
    phoneNumber: this.data.phone,
  })
},

运行结果:

 

 

更多:

http://ad.jnqianle.cn/ad/11.html

http://www.jnqianle.cn/Mina/Index

展开阅读全文
加载中
点击引领话题📣 发布并加入讨论🔥
打赏
0 评论
0 收藏
0
分享
返回顶部
顶部