wx.createIntersectionObserver()传this和null有什么区别?

发布于 6 年前作者 min279217 次浏览最后编辑 6 年前来自 ask

写代码发现传this,设置option: {thresholds: [0], initialRatio: 1}无效

而传null,有效,为什么???

2 回复
guiyingqin
guiyingqin1 楼4 年前

taro给出解决方案 传this.$scope,该对象是小程序的Vo对象

https://github.com/NervJS/taro/issues/4465

yan34
yan342 楼4 年前

有新的调用方式,看下面的链接

https://developers.weixin.qq.com/miniprogram/dev/api/wxml/wx.createIntersectionObserver.html

用this.createIntersectionObserver([options])代替wx.createIntersectionObserver试试。