iphonex xs xr xsmax 判断
export function isIphone() {
return /iphone/gi.test(window.navigator.userAgent)
}
export function isIphonXSeries() {
if (window !== 'undefined' && window && !isIphone()) return false;
const xSeriesConfig = [
{ //iPhone Xs(Max,Pro Max)
devicePixelRatio: 3,
width: 414,
height: 896,
},
{ // iPhone XR(11)
devicePixelRatio: 2,
width: 414,
height: 896,
},
{ // iPhone X(Xs,Pro)
devicePixelRatio: 3,
width: 375,
height: 812,
},
];
const {
devicePixelRatio,
screen: {
width, height
}
} = window;
return xSeriesConfig.some(item => item.devicePixelRatio === devicePixelRatio && item.width === width && item.height === height);
}
机型工具表 http://www.qijishow.com/down/standard.html 这里可以看到所有的机型