通过getTotal判断more是否true

This commit is contained in:
wkj 2025-06-13 13:37:34 +08:00
parent dbd52c8f26
commit e686d60bb4
3 changed files with 23 additions and 4 deletions

View File

@ -1018,12 +1018,17 @@ class ListNode extends EntityNode {
const { data, total } = sr;
assert(data);
const count = Object.keys(data).length;
const getTotal = this.getTotal;
this.pagination.more = count === this.pagination.pageSize;
if (typeof currentPage === 'number' && !append) {
this.pagination.currentPage = currentPage;
}
if (typeof total === 'number') {
this.pagination.total = total;
if (typeof getTotal === 'number' && this.pagination.more && total < getTotal) {
const pages = Math.floor((total - 1) / this.pagination.pageSize) + 1;
this.pagination.more = this.pagination.currentPage + 1 < pages;
}
}
if (append) {
this.pagination.count += count;
@ -2288,7 +2293,8 @@ export class RunningTree extends Feature {
// 切换分页pageSize就重新设置
return node.setPagination({
pageSize,
currentPage: 0
currentPage: 0,
total: undefined,
});
}
setCurrentPage(path, currentPage) {

View File

@ -1021,12 +1021,17 @@ class ListNode extends EntityNode {
const { data, total } = sr;
(0, assert_1.assert)(data);
const count = Object.keys(data).length;
const getTotal = this.getTotal;
this.pagination.more = count === this.pagination.pageSize;
if (typeof currentPage === 'number' && !append) {
this.pagination.currentPage = currentPage;
}
if (typeof total === 'number') {
this.pagination.total = total;
if (typeof getTotal === 'number' && this.pagination.more && total < getTotal) {
const pages = Math.floor((total - 1) / this.pagination.pageSize) + 1;
this.pagination.more = this.pagination.currentPage + 1 < pages;
}
}
if (append) {
this.pagination.count += count;
@ -2291,7 +2296,8 @@ class RunningTree extends Feature_1.Feature {
// 切换分页pageSize就重新设置
return node.setPagination({
pageSize,
currentPage: 0
currentPage: 0,
total: undefined,
});
}
setCurrentPage(path, currentPage) {

View File

@ -1261,12 +1261,18 @@ class ListNode<
const { data, total } = sr;
assert(data);
const count = Object.keys(data).length;
const getTotal = this.getTotal;
this.pagination.more = count === this.pagination.pageSize;
if (typeof currentPage === 'number' && !append) {
this.pagination.currentPage = currentPage;
}
if (typeof total === 'number') {
this.pagination.total = total;
if (typeof getTotal === 'number' && this.pagination.more && total < getTotal) {
const pages = Math.floor((total - 1) / this.pagination.pageSize) + 1;
this.pagination.more = this.pagination.currentPage + 1 < pages
}
}
if (append) {
this.pagination.count += count;
@ -2775,8 +2781,9 @@ export class RunningTree<ED extends EntityDict & BaseEntityDict> extends Feature
// 切换分页pageSize就重新设置
return node.setPagination({
pageSize,
currentPage: 0
});
currentPage: 0,
total: undefined,
} as any);
}
setCurrentPage<T extends keyof ED>(path: string, currentPage: number) {