微信小程序获取导航栏高度

时间:2021-01-22 10:02:34   收藏:0   阅读:1585

小程序获取右上角胶囊位置信息

// 获取设备信息
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

评论(0
© 2014 bubuko.com 版权所有 - 联系我们:wmxa8@hotmail.com
打开技术之扣,分享程序人生!