其它机型可以根据实际情况再添加
function isIphoneX(){
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
}
}
/* 函数使用 */
if(isIphoneX()){
document.getElementById("bottomNav").style.paddingBottom="10px";
document.querySelector(".mui-bar-tab").style.height="70px";
}
原文地址:https://www.cnblogs.com/wuzhaoyu/p/12055651.html