uniapp状态栏、导航栏、胶囊数据

// 获取状态栏高度
var statuBar = uni.getSystemInfoSync().statusBarHeight;

// 获取胶囊数据
var custom = wx.getMenuButtonBoundingClientRect()
// 获取胶囊的宽高
customWidth = custom.width
customHeight = custom.height
// 获取胶囊的上下左右坐标
customTop = custom.top
customBottom = cutsom.bottom
customLeft = custom.left
customRight = custom.right

// 获取导航栏(标题栏高度)高度
 = 胶囊高度+(顶部距离-状态栏高度)*2
var navigationBarHeight = custom.height + (custom.top - statuBar) * 2

// 总体高度 = 状态栏高度+导航栏高度
var navAllHeight = navigationBarHeight  + statuBar

 

posted @ 2022-12-05 14:39  听着music睡  阅读(659)  评论(0编辑  收藏  举报