27 lines
713 B
JavaScript
27 lines
713 B
JavaScript
function getWXStatusHeight() {
|
|
// #ifdef MP-WEIXIN
|
|
// 获取距上
|
|
const barTop = wx.getSystemInfoSync().statusBarHeight
|
|
// 获取胶囊按钮位置信息
|
|
const menuButtonInfo = wx.getMenuButtonBoundingClientRect()
|
|
// 获取导航栏高度
|
|
const barHeight = menuButtonInfo.height + (menuButtonInfo.top - barTop) * 2
|
|
let barWidth = menuButtonInfo.width
|
|
console.log('menuButtonInfo', menuButtonInfo)
|
|
let barLeftPosition = 375 - menuButtonInfo.right + menuButtonInfo.width
|
|
let menuButtonLeft = menuButtonInfo.left
|
|
let menuButtonRight = menuButtonInfo.right
|
|
return {
|
|
barHeight,
|
|
barTop,
|
|
barWidth,
|
|
barLeftPosition,
|
|
menuButtonLeft,
|
|
menuButtonRight
|
|
}
|
|
// #endif
|
|
}
|
|
|
|
export {
|
|
getWXStatusHeight,
|
|
} |