判断是否微信打开
isWx() {
function getIsWxClient() {
//window.navigator.userAgent属性包含了浏览器类型、版本、操作系统类型、浏览器引擎类型等信息,这个属性可以用来判断浏览器类型
var ua = navigator.userAgent.toLowerCase();
//通过正则表达式匹配ua中是否含有MicroMessenger字符串
if (ua.match(/micromessenger/i) == 'micromessenger') {
return true;
} else if (ua.indexOf('micromessenger') != -1) {
return true;
}
return false;
}
var iswx1 = getIsWxClient();
store.state.isWechat = 0;
if (iswx1) {
store.state.isWechat = 1
}
}
判断是否是iponeX
isIphoneX() {
// 兼容ipx底部
if (/iphone/gi.test(window.navigator.userAgent)) {
/* iPhone X、iPhone XS */
var x = (window.screen.width === 375 && window.screen.height === 812);
/* iPhone XS Max */
var xsMax = (window.screen.width === 414 && window.screen.height === 896);
/* iPhone XR */
var xR = (window.screen.width === 414 && window.screen.height === 896);
if (x || xsMax || xR) {
return true;
} else {
return false;
}
} else {
return false
}
}