Skip to content

Commit 73fce5f

Browse files
committed
fix: pagnitation not work when total change #1989
1 parent caa0a64 commit 73fce5f

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

components/vc-pagination/Pagination.jsx

+18
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,24 @@ export default {
120120
}
121121
});
122122
},
123+
total() {
124+
const newState = {};
125+
const newCurrent = calculatePage(this.pageSize, this.$data, this.$props);
126+
if (hasProp(this, 'current')) {
127+
const current = Math.min(this.current, newCurrent);
128+
newState.stateCurrent = current;
129+
newState.stateCurrentInputValue = current;
130+
} else {
131+
let current = this.stateCurrent;
132+
if (current === 0 && newCurrent > 0) {
133+
current = 1;
134+
} else {
135+
current = Math.min(this.stateCurrent, newCurrent);
136+
}
137+
newState.stateCurrent = current;
138+
}
139+
this.setState(newState);
140+
},
123141
},
124142
methods: {
125143
getJumpPrevPage() {

0 commit comments

Comments
 (0)