uni.getSystemInfo({
				success: function(e) {
					// #ifndef MP
					Vue.prototype.StatusBar = e.statusBarHeight;
					if (e.platform == 'android') {
						Vue.prototype.CustomBar = e.statusBarHeight + 50;
					} else {
						Vue.prototype.CustomBar = e.statusBarHeight + 45;
					};
					// #endif
					// #ifdef MP-WEIXIN
					Vue.prototype.StatusBar = e.statusBarHeight;
					let custom = wx.getMenuButtonBoundingClientRect();
					Vue.prototype.Custom = custom;
					Vue.prototype.CustomBar = custom.bottom + custom.top - e.statusBarHeight;
					// #endif       
					// #ifdef MP-ALIPAY
					Vue.prototype.StatusBar = e.statusBarHeight;
					Vue.prototype.CustomBar = e.statusBarHeight + e.titleBarHeight;
					// #endif
				}
			})

Vue.prototype.CustomBar = e.statusBarHeight + 50; 获取的是手机状态栏的高度与colorUI的导航栏的高度。

然后在其他页面中的data中定义这个高并且赋值 CustomBar : this.CustomBar

最后在页面最外层的view中动态绑定这个高,:style="{paddingTop:CustomBar +'px'}"

 

 

 

 

 

 

 

 

 

 

Logo

前往低代码交流专区

更多推荐