我是饿额
我是饿额
  • 发布:2020-12-08 15:15
  • 更新:2020-12-08 15:15
  • 阅读:1600

【报Bug】createIntersectionObserver、IntersectionObserver不起作用

分类:uni-app

产品分类: uniapp/小程序/微信

PC开发环境操作系统: Windows

PC开发环境操作系统版本号: win10

HBuilderX类型: 正式

HBuilderX版本号: 2.9.8

第三方开发者工具版本号: 1.03.2011120

基础库版本号: 2.9.2

项目创建方式: HBuilderX

示例代码:

const observer = uni.createIntersectionObserver(this)
.relativeToViewport()
.observe('.mounting-menu', data => {
console.log(123, data);
if (data.intersectionRatio < 1) {
this.mountingMenuShow = true;
} else {
this.mountingMenuShow = false;
}
});

操作步骤:

const observer = uni.createIntersectionObserver(this)
.relativeToViewport()
.observe('.mounting-menu', data => {
console.log(123, data);
if (data.intersectionRatio < 1) {
this.mountingMenuShow = true;
} else {
this.mountingMenuShow = false;
}
});

预期结果:

不出现报错信息,调试可以看到源码,createIntersectionObserver能起作用

实际结果:

运行报错,调试看不到源码,createIntersectionObserver不能起作用

bug描述:

使用uni.createIntersectionObserver(this)会报错
vendor.js:3686 [Vue warn]: 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: https://vuejs.org/v2/guide/reactivity.html#Declaring-Reactive-Properties.

(found in pages/index/index.vue)

2020-12-08 15:15 负责人:无 分享
已邀请:

该问题目前已经被锁定, 无法添加新回复