// app.js App({ onLaunch() { /* 计算tabbar+iphone安全距离 tabbar页面+100rpx*/ let safeAreaBottom = 0, capsule = wx.getMenuButtonBoundingClientRect(), height = 200, that = this; wx.getSystemInfo({ success(res) { //计算底部安全距离高度 // safeAreaBottom += res.screenHeight - res.safeArea.height; //计算自定义导航的高度 height = capsule.height + res.statusBarHeight + (capsule.top - res.statusBarHeight) + 8; that.globalData.safeAreaBottom = safeAreaBottom; //判断是否为平板 if (res.model.slice(0, 4) == "iPad") return that.globalData.myNavBorHeight = height; that.globalData.myNavBorHeight = height * 2; } }) }, globalData: { myNavBorHeight: null, //自定义头部导航高度 account_list: [], //用户列表 } })