Skip to content

Commit

Permalink
fix: infinite-scroll组件loadMore执行两次 (#533)
Browse files Browse the repository at this point in the history
  • Loading branch information
kongjing committed Jul 4, 2023
1 parent 7b3fcf8 commit cdd44ba
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions packages/vantui/src/infinite-scroll/infinite-scroll.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,12 @@ function InfiniteScroll_(
if ((!onRequest && status === 'loading') || immediately) {
setOnRequest(true)
const status = await loadMore()
setStatus(status)
nextTick(() => {
setOnRequest(false)
})
setTimeout(() => {
nextTick(() => {
setStatus(status)
setOnRequest(false)
})
}, 500)
}
},
[loadMore, onRequest, status],
Expand Down

0 comments on commit cdd44ba

Please sign in to comment.