-
Notifications
You must be signed in to change notification settings - Fork 373
Closed
Description
Hi.
thank you for the package. This package is the best so far for infinite scrolling !!!
I use vue-infinite-loading in my comments component.
usually before using vue-infinite-loading when I add a comment I call a fetch method to see the new data.
I'm using Laravel.
getComments($state) {
axios
.get(`/comment/${this.post}/fetchMore?page=` + this.page)
.then(
function(response) {
if (response.data.data.length) {
this.page++;
if (this.comments.length === 0) {
this.comments = response.data.data;
console.log("gotten page: " + this.page);
} else {
this.comments = this.comments.concat(response.data.data);
}
$state.loaded();
} else {
$state.complete();
}
}.bind(this)
)
.catch(function(error) {
return "There was an error.";
});
}
<infinite-loading @distance="1" spinner="spiral" @infinite="getComments" ref="infiniteLoading">
</infinite-loading>
How is it possible to fetch newly added comments?
I tried to reset the status in a method but that didn't work (i saw that in a StackOverflow question)
if (this.$refs.infiniteLoading) {
return this.$refs.infiniteLoading.stateChanger.reset();
}
I can't figure this out. :\ thank you
minsoo-web and devzom
Metadata
Metadata
Assignees
Labels
No labels