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