在onshow中使用mescroll-body组件this.mescroll.resetUpScroll()方法会报错,延迟50秒会正常
这个报错通常是由于在onShow生命周期中访问某些组件的属性或方法时,这些组件尚未完全初始化所导致的。
延迟50毫秒后调用resetUpScroll方法可能是因为这样做可以让组件有足够的时间进行初始化,从而避免了出现这个错误。
在onShow生命周期中,如果你需要访问组件的属性或方法,你可以尝试使用this.$nextTick()方法。这个方法会在下一个UI渲染周期之前执行你的回调函数,这样就可以确保组件已经被完全初始化了。例如:
onShow() { this.$nextTick(() => { this.mescroll.resetUpScroll() }) },
另外,如果你使用了uni-app的原生组件,比如使用了<scroll-view>组件,那么你需要在组件的onReady生命周期中才能够访问组件的方法和属性。因为原生组件需要在渲染完成后才能够被访问。
- resetUpScroll TypeError property Cannot 39resetupscroll typeerror property cannot properties typeerror reading cannot typeerror undefined property cannot properties typeerror undefined reading properties typeerror undefined uncaught interpreted typeerror integer cannot addeventlistener typeerror uncaught property typeerror non-mysql undefined property typeerror undefined property webpack properties undefined reading cannot