我的问题是:我正在尝试对我的数据表执行分页功能,它工作正常,但是当我更改表格中的项目限制时,页面总数不会更新。我该怎么办?我有这个过滤器:
filters: {
paginate: function(list) {
this.resultCount = this.movimientos.length;
if (this.currentPage >= this.totalPages) {
this.currentPage = Math.max(0, this.totalPages - 1);
}
var index = this.currentPage * this.upperLimit;
return this.movimientos.slice(index, index + this.upperLimit);
}
}
这里我正在计算页数
computed: {
totalPages: function() {
return Math.ceil(this.resultCount / this.itemsPerPage);
}
},
methods: {
setPage: function(pageNumber) {
this.currentPage = pageNumber;
},
<div v-for="pageNumber in totalPages" class="c-paginacao__select">
<a href="#" v-on:click.prevent="setPage(pageNumber)">
<span class="active">{{pageNumber+1}}</span>
</a>
</div>