如果不使用組件,可以直接使用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(); }); }