Skip to content

How to implement infinite-scroll #18906

Answered by nickmadev
prodev1107 asked this question in Q&A
Discussion options

You must be logged in to vote

Please refer my code 🚀
When the mouse scrolls 80% of the height, loadMore is called.

      <div @scroll="loadMore">
        <ListComponent />
      </div>
      
    loadMore(e) {
      const { scrollTop, clientHeight, scrollHeight } = e.target;
      if ((scrollTop + clientHeight) >= scrollHeight * 0.8) {
        this.loading = true;
        // function body
        this.loading = false;
      }
    }

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@prodev1107
Comment options

Answer selected by prodev1107
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants