uniAPP·DIV元素获取高度
uni.getSystemInfo({ //获取屏幕高度
success: res => {
this.windowHeight = res.windowHeight;
console.log("获取屏幕高度:",res.windowHeight) //res.windowHeight是返回的屏幕高度
}
});
// 获取元素高度
let query = uni.createSelectorQuery().in(this);
query.select('#info_TextContentID').boundingClientRect();
query.exec(res => {
console.log("元素高度:",res[0].height) // 元素高度
this.swiperHeight = res[0].height; // 返回的值可以用作动态修改swiper高度
});