我正在使用laravel-vue-pagination包在我的laravel vuejs项目上进行分页。但是当我单击下一页时,它没有呈现并转到第no页。第一页加载正常,我如何才能转到该页面2号?这是代码。是另一个组件。我确实将其添加到文档中。但仍然无法正常工作。
<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;
});
},
},
}