diff --git a/src/components/date-picker/panel/Date/date-range.vue b/src/components/date-picker/panel/Date/date-range.vue index ca017a4..005dc62 100644 --- a/src/components/date-picker/panel/Date/date-range.vue +++ b/src/components/date-picker/panel/Date/date-range.vue @@ -198,12 +198,6 @@ this.leftPanelDate = leftPanelDate; const rightPanelDate = new Date(leftPanelDate.getFullYear(), leftPanelDate.getMonth() + 1, leftPanelDate.getDate()); this.rightPanelDate = this.splitPanels ? new Date(Math.max(this.dates[1], rightPanelDate)) : rightPanelDate; - - // reset stuff - this.currentView = this.selectionMode || 'range'; - this.leftPickerTable = `${this.currentView}-table`; - this.rightPickerTable = `${this.currentView}-table`; - }, currentView(currentView){ const leftMonth = this.leftPanelDate.getMonth(); @@ -225,6 +219,11 @@ } }, methods: { + reset(){ + this.currentView = this.selectionMode; + this.leftPickerTable = `${this.currentView}-table`; + this.rightPickerTable = `${this.currentView}-table`; + }, panelLabelConfig (direction) { const locale = this.t('i.locale'); const datePanelLabel = this.t('i.datepicker.datePanelLabel'); diff --git a/src/components/date-picker/panel/Date/date.vue b/src/components/date-picker/panel/Date/date.vue index 529d8e4..10912f7 100644 --- a/src/components/date-picker/panel/Date/date.vue +++ b/src/components/date-picker/panel/Date/date.vue @@ -139,17 +139,21 @@ value (newVal) { this.dates = newVal; if (JSON.stringify(newVal) === '[null]') this.panelDate = this.startDate || new Date(); - - // reset stuff - this.currentView = this.selectionMode; - this.pickerTable = this.getTableType(this.currentView); }, currentView (currentView) { this.$emit('on-selection-mode-change', currentView); this.pickertable = this.getTableType(currentView); + }, + selectionMode(type){ + this.currentView = type; + this.pickerTable = this.getTableType(type); } }, methods: { + reset(){ + this.currentView = this.selectionMode; + this.pickerTable = this.getTableType(this.currentView); + }, changeYear(dir){ if (this.selectionMode === 'year'){ this.panelDate = new Date(this.panelDate.getFullYear() + dir * 10, 0, 1); diff --git a/src/components/date-picker/picker.vue b/src/components/date-picker/picker.vue index 742e035..4f753e5 100644 --- a/src/components/date-picker/picker.vue +++ b/src/components/date-picker/picker.vue @@ -35,6 +35,7 @@