【发布时间】:2021-10-05 15:24:48
【问题描述】:
我正在尝试创建一个函数,该函数允许我的表格数据每页仅显示一定数量的行,并具有下一页和上一页功能,而无需使用像 vuetify 这样的外部库。我设法将表格限制为每页 15 行,但我无法转到下一页。这是我的下一个和上一个功能
nextButton() {
if (this.quotes.length > this.rowsPerPage * (this.currentPage + 1)) {
this.currentPage += 1;
} else {
this.currentPage += 0;
}
},
previousButton() {
if (this.currentPage > 0) {
this.currentPage -= 1;
} else {
this.currentPage -=0;
}
},
这是我的计算函数,每页限制为 15 个
computed: {
quotesPerPage() {
return this.quotes.slice(0, this.rowsPerPage);
}
},
【问题讨论】:
标签: javascript vue.js