uniapp拨打电话:uni.makePhoneCall()

1.uni.makePhoneCall(OBJECT)

拨打电话。

 1 OBJECT 参数说明:
 2 参数名          类型        必填        说明
 3 phoneNumber    String        是            需要拨打的电话号码
 4 success        Function    否            接口调用成功的回调
 5 fail        Function    否            接口调用失败的回调函数
 6 complete    Function    否            接口调用结束的回调函数(调用成功、失败都会执行)
 7 
 8 <template>
 9     <view class="content">
10         <view @click="call_phone">拨打电话</view>
11     </view>
12 </template>
13 
14 //点击事件:拨打电话
15 call_phone() {
16     uni.makePhoneCall({
17         // 手机号
18         phoneNumber: '13783712192',
19         // 成功回调
20         success: (res) => {
21             console.log('调用成功!')
22         },
23         // 失败回调
24         fail: (res) => {
25             console.log('调用失败!')
26             this.call_phone();//重复调用一次
27         }
28     });
29 },

官方地址:https://uniapp.dcloud.io/api/system/phone?id=makephonecall

posted @ 2021-01-09 18:12  30Curry  阅读(4096)  评论(0编辑  收藏  举报