uni官方论坛上有些方法很不错
manifest.json 文件 app-plus 节点下配下 safearea
"safearea": {
"background": "#CCCCCC",
"bottom": {
"offset": "auto"
}
}
wx.getSystemInfo({
success: res => {
let _this = this;
if(res.safeArea.top > 20) { //x及以上的异形屏top为44,非异形屏为20
_this.globalData.isIphoneX = true;
}
}
})
page{
padding-bottom: constant(safe-area-inset-bottom);
padding-bottom: env(safe-area-inset-bottom);
}
铁子们有更好的方法欢迎留言给我,小白不易