i am using laravel-vue-pagination package for pagination on my laravel vuejs project.but when i click the next page it's not rendering and going to the page no.first page is loading fine.how can i go to the page number 2? here is the code. is another component.i did it accroding to the documentation.still it's not working.
<template>
<!-- Blog Comment threats -->
<div>
<h3>Comments (4)</h3>
<ul class="commentlist">
<comment :comments="comments.data"></comment>
</ul>
<pagination :data="comments" @pagination-change-page="getResults"></pagination>
</div>
<div>
</div>
<!-- blog comments form -->
<new-comment></new-comment>
<script>
import newComment from "./newComment.vue";
import Comment from "./Comment.vue"
export default {
components: {newComment, Comment},
props: ['post'],
data() {
return {
comments: {},
}
},
mounted() {
// Fetch initial results
this.getResults();
},
methods: {
getResults(page = 1) {
axios.get(`/api/post/${this.post}/comment?page=' + page`)
.then(response => {
this.comments = response.data;
});
},
},
}
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire