首先在app.js中判斷是否是哪種設備
globalData: {
isIphoneX: false,
userInfo: null
},
onShow:function(){
let that = this;
wx.getSystemInfo({
success: res=>{
// console.log('手機信息res'+res.model)
let modelmes = res.model;
if (modelmes.search('iPhone X') != -1) {
that.globalData.isIphoneX = true
}
}
})
},
wxml:
<view class='contentView' style='padding-bottom:{{btuBottom}}'> </view> //底部
js:
data: {
btuBottom""
},
//在這裏只需要判斷是不是iphonex,然後設置下padding-bottom:即可
onLoad: function (options) {
let isPhone = app.globalData.isIpx;
if(isPhone){
this.setData({
btuBottom:"68rpx",
})
}
}