概述
html:
<div class="btn_open" @click="openApp">打开APP</div>
script:
data () {
return {
brands : {
"IPHONE": "IPHONE|IPAD|IPOD|IOS",
"OPPO": "OPPO",
"VIVO": "VIVO",
"HONOR": "HONOR",
"HUAWEI": "HUAWEI",
"XIAOMI": "XIAOMI|REDMI",
"360": "1801-A01|1707-A01|1509-A00",
"SAMSUNG": "SAMSUNG"
},
hasOwnProp:'',
userAgent:'',
os:'',
brand:''
}
openApp(){
let device_type = navigator.userAgent;//获取userAgent信息
let ua_pub = window.navigator.userAgent;
let u = navigator.userAgent;
let isAndroid = u.indexOf('Android') > -1 || u.indexOf('Adr') > -1; //android终端
let ua = window.navigator.userAgent.toLowerCase();
let isWeixin = ua.indexOf('micromessenger') !== -1;
let href = window.location.href;
if (isWeixin)
{
window.location.href = "https://a.app.qq.com/o/simple.jsp?pkgname=包名";
return true;
}
else if(ua_pub.match(/(i[^;]+;( U;)? CPU.+Mac OS X/)){
return
// window.location.href = 'https://itunes.apple.com/cn/app/%E8%B6%A3%E5%90%AC%E5%B0%8F%E8%AF%B4-%E6%9C%89%E5%A3%B0%E5%B0%8F%E8%AF%B4%E6%87%92%E4%BA%BA%E5%90%AC%E4%B9%A6%E7%A5%9E%E5%99%A8/id1440140641?mt=8'
}else {
if(ua.match(/MicroMessenger/i) === 'micromessenger' && isAndroid) {
//应用宝
window.location.href ='https://a.app.qq.com/o/simple.jsp?pkgname=包名';
$('body,html').animate({scrollTop:0},300);
}
if(href.indexOf('dym') !== -1) { 大姨妈渠道
// alert('dym')
return
}else {
if (device_type.indexOf('HUAWEI') > -1) {
// alert('huawei')
window.location.href = "market://details?id=包名"
} else if (device_type.indexOf('OPPO') > -1||device_type.indexOf('Oppo') > -1) {
window.location.href = "market://details?id=包名"
} else if (device_type.indexOf('vivo') > -1) {
window.location.href = "vivoMarket://details?id=包名"
} else if (device_type.indexOf('MI') > -1 || device_type.indexOf('Mi') > -1 ) {
// alert('xiaomi')
window.location.href = "mimarket://details?id=包名"
} else if (device_type.indexOf('baidu') > -1) {
window.location.href = "https://a.app.qq.com/o/simple.jsp?pkgname=包名"
} else if (device_type.indexOf('360') > -1) {
window.location.href = "intent://details?id=包名#Intent;package=包名;scheme=market;end;"
} else { ///其他安卓手机
window.location.href = "https://a.app.qq.com/o/simple.jsp?pkgname=包名"
}
}
}
}
最后
以上就是勤奋心锁为你收集整理的vue h5点击跳转主流手机应用商店app下载页的全部内容,希望文章能够帮你解决vue h5点击跳转主流手机应用商店app下载页所遇到的程序开发问题。
如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。
发表评论 取消回复