uniapp 下拉加载


/*
  //nav切换 需要初始化数据

    this.taskList = [];
    this.totlePage='';
    this.params.page =1;
    this.count='';
    this.showTxt='';

*/


onReachBottom(){//uniapp 监听下拉加载生命周期
  this.fenye()
},

 

handleTaskList() {//请求数据
  this.$http({
    url: '/project/project/project_merchant_list',
    data: data,
    method:'post'
  }).then(res => {
    this.count = res.response_data.count;
    this.taskList = this.taskList.concat(res.response_data.lists);//合并数组
})
},


fenye(){
//获取列表之后 this.totlePage = Math.ceil(this.count / this.params.num); //页面触底事件 if(this.params.page >= this.totlePage){ this.showTxt = '加载完成'; return; } this.showTxt = '加载中...'; this.params.page ++; this.handleTaskList() },

猜你喜欢

转载自www.cnblogs.com/fanqiuzhuji/p/12485254.html