From dcf0488a3e89e474f2149212c26f6d0e109cb7cd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E5=A5=95?= Date: Sun, 8 Apr 2018 13:58:47 +0800 Subject: [PATCH] Pagination: ensure currentPage is updated in current-change handler (#10599) --- packages/pagination/src/pagination.js | 10 ++++------ test/unit/specs/date-picker.spec.js | 2 +- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/packages/pagination/src/pagination.js b/packages/pagination/src/pagination.js index 5e359183a..cfcdf98ca 100644 --- a/packages/pagination/src/pagination.js +++ b/packages/pagination/src/pagination.js @@ -390,12 +390,10 @@ export default { } if (newVal !== undefined) { - this.$nextTick(() => { - this.internalCurrentPage = newVal; - if (oldVal !== newVal) { - this.$emit('update:currentPage', newVal); - } - }); + this.internalCurrentPage = newVal; + if (oldVal !== newVal) { + this.$emit('update:currentPage', newVal); + } } else { this.$emit('update:currentPage', newVal); } diff --git a/test/unit/specs/date-picker.spec.js b/test/unit/specs/date-picker.spec.js index 20d56a219..44b2702a5 100644 --- a/test/unit/specs/date-picker.spec.js +++ b/test/unit/specs/date-picker.spec.js @@ -278,7 +278,7 @@ describe('DatePicker', () => { input.focus(); setTimeout(_ => { const picker = vm.$refs.compo.picker; - picker.$el.querySelector('td.available + td.today').click(); + picker.$el.querySelector('td.available').click(); setTimeout(_ => { const date = vm.$refs.compo.picker.date; expect(date.getHours()).to.equal(12);