解决小程序iphoneX手机底部的兼容问题

首先在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:
   //底部

js:

data: {
  btuBottom""
  },

//在这里只需要判断是不是iphonex,然后设置下padding-bottom:即可

  onLoad: function (options) {
    let isPhone = app.globalData.isIpx;
    if(isPhone){
      this.setData({
        btuBottom:"68rpx",
      })
    }
}

你可能感兴趣的:(解决小程序iphoneX手机底部的兼容问题)