lanan-app/utils/utils.js

27 lines
713 B
JavaScript
Raw Permalink Normal View History

2024-08-21 20:18:30 +08:00
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,
}