去除首页hometop方法里的 rect.top报错问题

This commit is contained in:
2025-10-27 09:28:33 +08:00
parent 845d9f7b40
commit 6283d168e9

View File

@@ -194,7 +194,9 @@ const hometop = async () => {
const query = uni.createSelectorQuery().select('#fourcontent'); const query = uni.createSelectorQuery().select('#fourcontent');
query query
.boundingClientRect((rect) => { .boundingClientRect((rect) => {
elementTop.value = rect.top - store.height; if(rect){
elementTop.value = rect.top - store.height;
}
}) })
.exec(); .exec();
}, 500); }, 500);