Compare commits

...

2 Commits

Author SHA1 Message Date
wenjiarui cfdcdb0fbb Merge branch 'dev' of gitea.51mars.com:Oak-Team/oak-frontend-base into dev 2024-07-23 10:10:38 +08:00
wenjiarui 4f92d19530 pagination首次进入页面容错 2024-07-23 10:10:34 +08:00
1 changed files with 6 additions and 3 deletions

View File

@ -20,18 +20,21 @@ export default OakComponent({
},
listeners: {
oakPagination(prev, next) {
let newTotal2 = 0;
if (prev.oakPagination?.total !== next.oakPagination?.total) {
const { total } = next.oakPagination || {};
if (total) {
this.setState({ newTotal: total });
newTotal2 = total;
}
}
if (prev.oakPagination?.currentPage !== next.oakPagination?.currentPage) {
const { pageSize, currentPage, more } = next.oakPagination || {};
const { newTotal } = this.state;
if (newTotal && pageSize) {
if (Math.ceil(newTotal / pageSize) === currentPage && more) {
this.setState({ newTotal: newTotal + pageSize });
let newTotal3 = newTotal || newTotal2;
if (newTotal3 && pageSize) {
if (Math.ceil(newTotal3 / pageSize) === currentPage && more) {
this.setState({ newTotal: newTotal3 + pageSize });
}
}
}