uni 内部提供了一个makePhoneCall函数
那我们就直接看代码
<template>
<view @click = "phone">13510657575</view>
</template>
<script>
export default {
data() {
return {
}
},
onLoad() {
},
methods: {
phone() {
uni.makePhoneCall({
phoneNumber: '1351-065-7575'
})
}
}
}
</script>
<style>
</style>
简单说 用户点击元素时 自动触发phone函数 phone里调用了uni内置的makePhoneCall函数 参数是一个对象 phoneNumber对应的就是要拨打的电话
用户点击效果如下
在手机中运行就会体现出更好的效果