v-infinite-scroll 上拉加载 请求两次

在接口返回数据的时候 infinite-scroll-disabled置为false

loadMore: function() {
  if (this.page > this.total) {
    return false;
  }
  this.busy = true;
  // 每次获取this.rows,
  this.showLoading = true;
  var params = {
    time: this.portmonth,
    userId: JSON.parse(localStorage.getItem("user")).userId,
    type: 0,
    page: this.page,
    rows: this.rows,
    isfy: 1,
    tabtype: this.index,
    findUserId: this.findUserId
  };

  postTaskList(params)
    .then(res => {
      this.showLoading = false;
      var result = res.data;
      if (result.Status == -1) {
        alert(result.Explain);
        return false;
      }
      if (this.page > this.total) {
        return false;
      }
      this.tasklist = this.tasklist.concat(result.Data.rows);
      if (this.tasklist.length > 0) {
        this.nodata = false;
      } else {
        this.nodata = true;
      }
      this.page = this.page + 1;
      this.total = result.Data.total;
      this.busy = false;
    })
    .catch(e => {
      this.busy = false;
      this.showLoading = false;
      console.log(e);
    });
},

你可能感兴趣的:(前端)