Skip to content

首次加载,会不停的加载数据,滚动条距离底部很远它自己就发起请求了,这是什么原因呢 #106

@qiqingfu

Description

@qiqingfu
loadMore() {
      this.busy = true;
      setTimeout(() => {
        this.pageSize.currentPage ++;
        this.getShopListHander(true);   //分页商品数据需要累加
      }, 500)
},

这是请求接口的方法

async getShopListHander(flag) {
      let res = await axios.get('/api/goods', {params: this.pageSize});
      console.log(res);
      if (res.data.code === 200) {
        if (flag) {
          this.datalist = [...this.datalist, ...res.data.data];
          // 如果已经全部加载完毕, length = 0;
          if (res.data.length === 0) {
            this.busy = true;
          } else {
            this.busy = false;
          }
        } else {
          this.datalist = res.data.data;
          this.busy = true;
        }
      } else {
        this.datalist = []
      }
    },

数据请求回来之后,我设置为false后。那时候滚动条距离底部很长的一段距离。 自动发起请求了,直到数据请求完毕。

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions