麦东西
麦东西
  • 发布:2020-04-19 21:45
  • 更新:2022-10-21 11:21
  • 阅读:2101

createIntersectionObserver 报错

分类:uni小程序sdk

使用uni.createIntersectionObserver(this);
微信小程序报错

Property or method "toJSON" is not defined on the instance but referenced during render. Make sure that this property is reactive, either in the data option, or for class-based components, by initializing the property. See

VM4841:1 TypeError: Converting circular structure to JSON
--> starting at object with constructor 'Object'
--- property '_renderProxy' closes the circle
at JSON.stringify (<anonymous>)

2020-04-19 21:45 负责人:无 分享
已邀请:
3***@qq.com

3***@qq.com

修改为
observer = this.createIntersectionObserver({
observeAll: true
});
即可

官方应给升级下 uni.createIntersectionObserver
对应情况编译成
this.createIntersectionObserver({
observeAll: true
});

  • 6***@qq.com

    感谢分享 不会报 JSON 错误 但是 observeAll 好像不生效了...

    报另一个错误"Error: "observe" call can be only called once in IntersectionObserver"

    2020-09-30 15:03

4***@qq.com

4***@qq.com

大佬解决了吗 我也是有这个问题 虽然好像没有影响

3***@qq.com

3***@qq.com

今天遇到同样的问题,之前没有,有可能是编译器升级了之后出现的,这个咋解决的?

6***@qq.com

6***@qq.com

mark 同求

2***@qq.com

2***@qq.com

将uni.createIntersectionObserver(this)改成this.createIntersectionObserver();只针对微信小程序

t***@126.com

t***@126.com

在data中添加一个toJSON属性就行了,
然后用回官方的用法,不用再改了

要回复问题请先登录注册