我在使用vue3+ts+setup的时候使用uni.createIntersectionObserver在安卓打包报错Uncaught TypeError: e.querySelector is not a function at uni-app-view.umd.js:7
下面是代码
// #ifdef MP-WEIXIN || APP-PLUS
setTimeout(() => {
console.log('====')
const proxy = getCurrentInstance()?.proxy
const intersectionObserver = uni.createIntersectionObserver(proxy, {
thresholds: [0, 1] // 定义两个阈值,分别为0和1
})
intersectionObserver.relativeToViewport().observe('.load-more', (res) => {
if (res.intersectionRatio === 1) {
// 当 .loadMore 元素完全进入视口时执行你的方法
console.log('------')
}
})
}, 10000)
// #endif
就定时走了10秒,最后还是报这个错
1 个回复
4***@qq.com (作者)
h5的我已经用浏览器原生的InterdectionObserver解决了,但是就是APP端,无法解决