let app = uni.getSystemInfoSync()
let topHight = app.statusBarHeight
console.log('顶部安全距离',topHight) //44
let app = uni.getSystemInfoSync();
let bottomHight = app.safeAreaInsets.bottom //屏幕底部安全距离
console.log('屏幕底部安全距离', bottomHight) //34
uni.createSelectorQuery().select('.box').boundingClientRect(res => {
console.log('高度', res.height); // 50 .box元素高度
}).exec();
uni.createSelectorQuery().select('.box').boundingClientRect(res => {
console.log(res.top); // .box元素距离顶部的距离
}).exec()
网友评论