Pull-to-load functionality implemented with iScroll.js and Vue.js
Add-ons

Plugin description: When developing mobile projects with Vue, I found that most iScroll plugins were incompatible, resulting in inaccurate scroller height calculations and preventing scrolling. So I wrote a simple implementation myself. I hope beginners who encounter the same problem can share their experiences and learn from each other.
Written based on the official iScroll documentation:
First, initialize a new iScroll instance in window.onload.
Second, configure the iScroll parameters (all written together here, but you can also use the following section to configure them). myscroll.onScrollMove = function To configure them.
Third, use is_r to control whether requests are sent.
Vue section
static controls the display of the status indicator: 0 means pull up, 1 means loading, and 2 means loading completed.
If no special requirements exist, simply wrap the for loop in the onScrollMove method and the section below it inside the success callback of the AJAX request.
The implementation is a bit rough, but I hope it helps fellow developers who encounter the same problem!
评论