diff --git a/src/components/date-picker/panel/date-range.vue b/src/components/date-picker/panel/date-range.vue index 869ecf4..9ff6a80 100644 --- a/src/components/date-picker/panel/date-range.vue +++ b/src/components/date-picker/panel/date-range.vue @@ -234,14 +234,29 @@ } }, methods: { + resetDate () { + this.date = new Date(this.date); + this.leftTableYear = this.date.getFullYear(); + this.rightTableYear = this.rightDate.getFullYear(); + }, handleClear() { this.minDate = null; this.maxDate = null; + this.date = new Date(); this.handleConfirm(); }, + resetView() { + this.leftCurrentView = 'date'; + this.rightCurrentView = 'date'; + + this.leftTableYear = this.leftYear; + this.rightTableYear = this.rightYear; + }, prevYear (direction) { if (this[`${direction}CurrentView`] === 'year') { this.$refs[`${direction}YearTable`].prevTenYear(); + } else if (this[`${direction}CurrentView`] === 'month') { + this[`${direction}TableYear`]--; } else { const date = this.date; date.setFullYear(date.getFullYear() - 1); @@ -251,6 +266,8 @@ nextYear (direction) { if (this[`${direction}CurrentView`] === 'year') { this.$refs[`${direction}YearTable`].nextTenYear(); + } else if (this[`${direction}CurrentView`] === 'month') { + this[`${direction}TableYear`]--; } else { const date = this.date; date.setFullYear(date.getFullYear() + 1); diff --git a/src/components/date-picker/panel/date.vue b/src/components/date-picker/panel/date.vue index 61cbffd..fc73c6b 100644 --- a/src/components/date-picker/panel/date.vue +++ b/src/components/date-picker/panel/date.vue @@ -124,6 +124,9 @@ } }, methods: { + resetDate () { + this.date = new Date(this.date); + }, handleClear() { this.date = new Date(); this.$emit('on-pick', ''); diff --git a/src/components/date-picker/panel/mixin.js b/src/components/date-picker/panel/mixin.js index c41cd44..1e0e353 100644 --- a/src/components/date-picker/panel/mixin.js +++ b/src/components/date-picker/panel/mixin.js @@ -13,9 +13,6 @@ export default { handleShortcutClick (shortcut) { if (shortcut.value) this.$emit('on-pick', shortcut.value()); if (shortcut.onClick) shortcut.onClick(this); - }, - resetDate () { - this.date = new Date(this.date); } } } \ No newline at end of file -- libgit2 0.21.4