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


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM