TypeError: Cannot read property 'height' of null
at Object.<anonymous> (index.vue:356)
at Function.<anonymous> (WAServiceMainContext.js?t=wechat&s=1753437192620&v=3.8.12:1)
at :38694/appservice/<SelectorQuery callback function>
at WAServiceMainContext.js?t=wechat&s=1753437192620&v=3.8.12:1
at WAServiceMainContext.js?t=wechat&s=1753437192620&v=3.8.12:1
at Array.forEach (<anonymous>)
at WAServiceMainContext.js?t=wechat&s=1753437192620&v=3.8.12:1
at WAServiceMainContext.js?t=wechat&s=1753437192620&v=3.8.12:1
at WASubContext.js?t=wechat&s=1753437192620&v=3.8.12:1
at pe (WASubContext.js?t=wechat&s=1753437192620&v=3.8.12:1)
代码如下:
let self = this
// #ifdef MP
// 获取小程序头部高度
this.navH = app.globalData.navHeight;
let info = uni.createSelectorQuery().select(".mp-header");
info.boundingClientRect(function(data) {
self.marTop = data.height
self.poTop = Number(data.height) + 84
}).exec()
// #endif