uniapp 拨打电话 - uni.makePhoneCall(tel)

uniapp 用uni.makePhoneCall( )拨打电话

image

点击查看代码
<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

posted @ 2021-12-30 15:42  蓦然JL  阅读(2057)  评论(0编辑  收藏  举报
访问主页
关注我
关注微博
私信我
返回顶部