// 获取设备信息
wx.getSystemInfo({
success: e => { // { statusBarHeight: 20, ... },单位为 px
// 获取右上角胶囊的位置信息
let info = wx.getMenuButtonBoundingClientRect() // { bottom: 58, height: 32, left: 278, right: 365, top: 26, width: 87 },单位为 px
let CustomBar = info.bottom + info.top - e.statusBarHeight
}
})
微信小程序获取头部高度
最新推荐文章于 2024-04-25 10:36:05 发布