小程序动态获取自定义Tabbar的高度
1、在 tabbar 组件 js文件的 ready
方法中加入以下代码
ready() {
const query = wx.createSelectorQuery().in(this)
query.select('.tab-bar').boundingClientRect((rect) => {
// 缓存tabbar栏的高度
wx.setStorageSync('tabbarHeight', rect.height)
}).exec()
}
2、需要使用的时候
wx.getStorageSync('tabbarHeight')