let info = uni.createSelectorQuery().in(this).select(".footer-nav");
info.boundingClientRect(function(data) {
console.log(data)
console.log(data.height) // 获取元素宽度
}).exec(function(res){
// 注意:exec方法必须执行,即便什么也不做,否则不会获取到任何数据
})
打印结果:
{
bottom: 812,
dataset: {},
height: 65,
id: "",
left: 0,
right: 375,
top: 747,
width: 375,
}
65