**1获取胶囊的详细信息 **
let menuButtonObject = wx.getMenuButtonBoundingClientRect();
width:胶囊的宽度; height:胶囊的高度 top:胶囊距离顶部的距离
2获取导航栏的整体高度
wx.getSystemInfo({
success: res => {
let statusBarHeight = res.statusBarHeight,navTop = menuButtonObject.top,
navHeight = statusBarHeight + menuButtonObject.height + (menuButtonObject.top - statusBarHeight) * 2;
}
})
*整体高度: 状态栏高度+胶囊高度+(胶囊距离-胶囊高度)2
navHeight = statusBarHeight + menuButtonObject.height + (menuButtonObject.top - statusBarHeight) * 2;
3获取胶囊距离右边的距离
res.windowWidth - menuButtonObject.right
4完整获取代码:
let menuButtonObject = wx.getMenuButtonBoundingClientRect();
wx.getSystemInfo(