From 73fce5fc88392c10154df64e41fc94db77e32062 Mon Sep 17 00:00:00 2001 From: tanjinzhou <415800467@qq.com> Date: Tue, 31 Mar 2020 13:48:01 +0800 Subject: [PATCH] fix: pagnitation not work when total change #1989 --- components/vc-pagination/Pagination.jsx | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/components/vc-pagination/Pagination.jsx b/components/vc-pagination/Pagination.jsx index efc34dfe8..3af853e58 100644 --- a/components/vc-pagination/Pagination.jsx +++ b/components/vc-pagination/Pagination.jsx @@ -120,6 +120,24 @@ export default { } }); }, + total() { + const newState = {}; + const newCurrent = calculatePage(this.pageSize, this.$data, this.$props); + if (hasProp(this, 'current')) { + const current = Math.min(this.current, newCurrent); + newState.stateCurrent = current; + newState.stateCurrentInputValue = current; + } else { + let current = this.stateCurrent; + if (current === 0 && newCurrent > 0) { + current = 1; + } else { + current = Math.min(this.stateCurrent, newCurrent); + } + newState.stateCurrent = current; + } + this.setState(newState); + }, }, methods: { getJumpPrevPage() {