uniapp微信小程序获取手机状态栏高度

uni.getSystemInfo({
    
    
	success: (data)=> {
    
    
			let custom = wx.getMenuButtonBoundingClientRect()
			//导航栏高度 = 状态栏到胶囊的间距(胶囊距上距离-状态栏高度) * 2 + 胶囊高度 + 状态栏高度。
			this.navHeight = custom.bottom + custom.top - data.statusBarHeight
		}
})

猜你喜欢

转载自blog.csdn.net/qq_44540152/article/details/119409272
今日推荐