uni-app 在组件中触底分页的方法

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

 

posted @ 2021-12-23 16:27  fogwu  阅读(1388)  评论(0编辑  收藏  举报