vue移动项目中如何设置点击手机号码就可以打电话

1, 在vue项目的index.html中添加如下代码:

<meta name="format-detection" content="telephone=yes" />

,2,在需要调起手机拨号功能的页面,写如下方法:

callPhone (phoneNumber) {
    window.location.href = 'tel://' + phoneNumber
}

3,在拨号的页面调用此方法

<span @click="callPhone(Phone)">{{Phone}}</span>     
// Phone是请求得到的数据
Logo

Vue社区为您提供最前沿的新闻资讯和知识内容

更多推荐