uniapp 用uni.makePhoneCall( )撥打電話

點擊查看代碼
<template>
<view class="content">
<view @click="call_phone(tel)">撥打電話</view>
</view>
</template>
<script>
export default {
data() {
return {
tel:'13000000000' //要撥打的電話號碼
}
},
methods: {
//點擊事件:撥打電話
call_phone(phone) {
uni.makePhoneCall({
phoneNumber : phone,
// 成功回調
success: (res) => {
console.log('調用成功!')
},
// 失敗回調
fail: (res) => {
console.log('調用失敗!')
}
});
},
}
}
</script>
詳情請參考:https://uniapp.dcloud.io/api/system/phone?id=makephonecall
