问题描述:
由于onReachBottom、onPageScroll是页面生命周期回调方法,使用onReachBottom时第一级页面一定要使用onReachBottom,监听的onReachBottom可以为空函数。onPageScroll同理。
还有一定要在使用onReachBottom的子组件的setup语法糖使用onReachBottom,最上级页面可以不用setup。
用法示例:
例如一个四级嵌套页面。
那么第一级页面一定要加一下代码,以onReachBottom为例

import { onReachBottom } from '@dcloudio/uni-app';
// 触底
onReachBottom(() => {})

第二第三级子组件可以为空。然后在有需要使用的第四级子组件用onReachBottom就行了

Logo

有“AI”的1024 = 2048,欢迎大家加入2048 AI社区

更多推荐