报错信息:
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*/
Logo

华为开发者空间,是为全球开发者打造的专属开发空间,汇聚了华为优质开发资源及工具,致力于让每一位开发者拥有一台云主机,基于华为根生态开发、创新。

更多推荐