学无先后,达者为师

网站首页 编程语言 正文

uniapp H5页面内获取手机号拨打电话

作者:maoge_666 更新时间: 2023-07-17 编程语言

H5页面直接用

<!-- #ifdef H5 -->
  <a href="tel:10086">h5平台下拨打</a>
  <!-- #endif -->

动态获取手机号拨打:

<view>
	<a :href="'tel:' + phone">拨打</a>
</view>
data() {
	return {
		phone: ''
	}
},

APP:

<view @click="boda">
		<!-- #ifdef APP-PLUS -->
		<text>{{phone}}</text>
		<!-- #endif -->
		<!-- #ifdef H5 -->
		<a :href='phones'>{{phone}}</a>
		<!-- #endif -->
</view>

<script>
export default {
	data() {
			return {
				phone: '',
				phones: '',
			}
	},
    onShow() {
        //H5
		this.phones = 'tel:' + 10086
	},
   	methods: {
		boda() {
			uni.makePhoneCall({
					phoneNumber: this.phone
			});
		},	
	}
	
}
</script>

原文链接:https://blog.csdn.net/maoge_666/article/details/130103453

  • 上一篇:没有了
  • 下一篇:没有了
栏目分类
最近更新