UNIAPP 中selectAll节点的使用

					const query = uni.createSelectorQuery().in(this);
					query.selectAll('.catelog').boundingClientRect(rects => {
						rects.forEach(rect => {
							// 这里的滚动触发 可能是1ms触发,由于有时间间隔,如果滚动过快就可能导致rect.top取值不精确,所以用一个范围作为判断
							if (Number.parseInt(rect.top) >= 0 && 100 >= Number.parseInt(rect.top)) {
								// console.log(rect.id)
								uni.$emit('update', rect.id)
							}
						})
					}).exec()

你可能感兴趣的:(JS,js)