1. WeChat applet realizes the function of making phone calls
WeChat Mini Program > API > Device > Make a call
js interface wx.makePhoneCall(OBJECT) , used to make phone calls
OBJECT parameter description:
parameter | Types of | Required | illustrate |
---|---|---|---|
phoneNumber | String | Yes | phone number to call |
success | Function | no | Callback for successful interface call |
fail | Function | no | Callback function for interface call failure |
complete | Function | no | The callback function of the end of the interface call (the call will be executed if it succeeds or fails) |
2. Example of use:
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,
})
},
operation result:
More: