报错信息:
An SelectorQuery call is ignored because no proper page or component is found. Please considering using SelectorQuery.in
to specify a proper one.
解决办法:
/*#ifdef APP-PLUS*/// app
let info= uni.createSelectorQuery().in(this).select('#tableHead');
info.boundingClientRect(data => {
// data是当前元素的高度
this.headerHeight = data.height;
}).exec();
/*#endif*/
/*#ifdef MP*///小程序
const query = this.createSelectorQuery().select('#tableHead');
query.fields({
size: true
}, data => {
this.headerHeight = data.height;
}).exec();
/* #endif*/