说明: 为方便自取
获取页面高度
uni.getSystemInfoSync()
获取元素高度
- app端
const query = uni.createSelectorQuery().in(this)
query
.select('#box')
.boundingClientRect(data => {
console.log(data.height)
})
.exec();
- H5端
const query = uni.createSelectorQuery();
query
.select('#box')
.boundingClientRect(data => {
console.log(data.height)
})
.exec();