Commit 0866e4d0 authored by hewenhao's avatar hewenhao

feat: update

parent 409fc789
......@@ -36,19 +36,25 @@ Component({
if (this._loading || !this._hasNextPage) return
this._loading = true
this.setData({ loading: true })
await new Promise(resolve => setTimeout(resolve, 300))
const { list } = this.data
const currentPage = this._currentPage
const nextPage = currentPage + 1
let max = nextPage * PageSize
let hasNextPage = true
if (max >= list.length) {
max = list.length
hasNextPage = false
}
const start = currentPage * PageSize
const newList = list.slice(start, max)
const opts = {} as any
newList.forEach((item, index) => {
opts[`realList[${index + start}]`] = item
})
......@@ -57,7 +63,6 @@ Component({
this.setData(opts, () => {
this._loading = false
this._currentPage = nextPage
console.log(11111111, this._loading, hasNextPage)
this._hasNextPage = hasNextPage
})
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment