4***@qq.com
4***@qq.com
  • 发布:2024-07-16 17:39
  • 更新:2024-07-17 10:25
  • 阅读:417

我在使用vue3+ts+setup的时候使用uni.createIntersectionObserver在安卓打包报错

分类:uni-app

我在使用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秒,最后还是报这个错

2024-07-16 17:39 负责人:无 分享
已邀请:
4***@qq.com

4***@qq.com (作者)

h5的我已经用浏览器原生的InterdectionObserver解决了,但是就是APP端,无法解决

要回复问题请先登录注册