ElemeFE / vue-infinite-scroll

An infinite scroll directive for vue.js.
2.86k stars 416 forks source link

第一页数据未填满屏幕,如何自动加载第二页? #89

Closed MarvinXu closed 1 year ago

MarvinXu commented 6 years ago

第一页数据加载还没有触发scroll,目前是这么处理的:

loadMore() {
  if (!this.lastPage) {
    this.page++
      native.clickLog('productmore')
    this.getProdList()
  }
},
getProdList() {
  this.busy = true
  getProdList(this.queryStr, this.page)
    .then(data => {
      this.prodList = this.page === PAGE_START_NUM ? data.datas : this.prodList.concat(data.datas)
      this.lastPage = !data.hasNext
    })
    .then(() => {
      this.busy = false
    })
    .then(() => {
      const reachBottom = this.$refs.prodList.getBoundingClientRect().bottom >= window.innerHeight
      if (!reachBottom) {
        this.loadMore()
      }
    })
}
nathanboktae commented 6 years ago

From Google Translate for English speakers:

The first page of data does not fill the screen, how to automatically load the second page?

The first page of data has not been triggered scroll, the current treatment is so

I had the same issue, and I worked around it by using the infinite-scroll-listen-for-event and firing that after I loaded data, and it works properly (e.g. if loading is currently disabled, it doesn't do anything).

17862974826 commented 1 year ago

这是来自QQ邮箱的假期自动回复邮件。   您好,我最近正在休假中,无法亲自回复您的邮件。我将在假期结束后,尽快给您回复。