// 获取设备信息
uni.getSystemInfo({
success: e => { // { statusBarHeight: 20, ... },单位为 px
// 获取右上角胶囊的位置信息
let info = uni.getMenuButtonBoundingClientRect() // { bottom: 58, height: 32, left: 278, right: 365, top: 26, width: 87 },单位为 px
let CustomBar = info.bottom + info.top - e.statusBarHeight
console.log(‘设备信息‘,CustomBar)
}
})
原文:https://www.cnblogs.com/1748sb/p/14311613.html