So, I can't for the life of me figure out how to get a proper infinite scroll done with VueJS and vue-resource. My data is loading with VueJS and vue-resource, but the trigger on scroll and proper handling is the issue.
Does anybody know how to do this? All attempts I tried lead to loads of double requests and spamming my backend with repeat requests.
What I've tried so far:
Wrapping the "this.$http.get" request into a en event listener for window.scroll and a conditional within that, which checks if the bottom of the page is reached. This would alway double or even multi-trigger the get request instead of just one trigger and then waiting for load again.
Doing something similar but with an element at the very bottom of the list where I would check if it was in view. The same thing with multi-triggering get requests.
isFetching = false;. Then, you only fetch data ifisFetchingis false. You set it to true when you're getting data and set it back to false once the data has been fetched.