Skip to content

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

@MarvinXu

Description

@MarvinXu

第一页数据加载还没有触发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()
      }
    })
}

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