如果不使用组件,可以直接使用onReachBottom来分页,但是子组件不支持这个生命周期。所以需要通过 uni的emit传递动作来达到目的。
父组件:
onReachBottom() { console.log("i am fogwang"); uni.$emit('onReachBottom'); }
子组件:
mounted(e) { let that=this; uni.$once('onReachBottom',function(data){ console.log('触底了!'); that.pageing(); }); }