h5会出问题原因是uviewplus组件问题,所以代码是没问题
const getSectionHeight = () => {
// 创建选择器对象## 标题
var query = uni.createSelectorQuery()
query
.select('.section')
.boundingClientRect((data) => {
if (data) {
sectionHeight.value = data.height
}
})
.exec() // 执行选择器查询
}
watchEffect(() => {
safeHight.value =
uni.getSystemInfoSync().safeArea.height - 44 * 3 - sectionHeight.value - 8
})
onMounted(() => {
getSectionHeight()
})