您可以使用uniapp提供的API来调起拨打手机号的功能。具体步骤如下:
- 在template标签内添加一个按钮,例如:
<template>
<view>
<button type="primary" @click="callPhone">拨打客服电话</button>
</view>
</template>
- 在methods中定义callPhone方法:
methods: {
callPhone() {
uni.makePhoneCall({
phoneNumber: '电话号码'
});
}
}
- 在uni.makePhoneCall方法中传入需要拨打的电话号码即可。
完整代码示例:
<template>
<view>
<button type="primary" @click="callPhone">拨打客服电话</button>
</view>
</template>
<script>
export default {
methods: {
callPhone() {
uni.makePhoneCall({
phoneNumber: '电话号码'//手机号码
});
}
}
}
</script>