一、动态获取元素的宽度高度以及距离页面上下左右的距离
const query = uni.createSelectorQuery().in(this) query.select('.home-active').boundingClientRect(data => { console.log(data) }).exec()
二、动态获取元素的高度(返回元素的高度和宽度)
const selector = uni.createSelectorQuery().select('.home-active'); selector.fields({size:true},data=>{ console.log(data) }).exec()