Commit 02859de9b12364ccb6201a026a70ce254053c025
1 parent
2332ac9b
Use the last picked date as reference for the date panel
Showing
2 changed files
with
7 additions
and
2 deletions
Show diff stats
src/components/date-picker/panel/Date/date.vue
@@ -92,7 +92,11 @@ | @@ -92,7 +92,11 @@ | ||
92 | mixins: [ Mixin, Locale, DateMixin ], | 92 | mixins: [ Mixin, Locale, DateMixin ], |
93 | components: { Icon, DateTable, YearTable, MonthTable, TimePicker, Confirm, datePanelLabel }, | 93 | components: { Icon, DateTable, YearTable, MonthTable, TimePicker, Confirm, datePanelLabel }, |
94 | props: { | 94 | props: { |
95 | - // in the mixin | 95 | + // more props in the mixin |
96 | + multiple: { | ||
97 | + type: Boolean, | ||
98 | + default: false | ||
99 | + } | ||
96 | }, | 100 | }, |
97 | data () { | 101 | data () { |
98 | const {selectionMode, value} = this; | 102 | const {selectionMode, value} = this; |
@@ -141,7 +145,7 @@ | @@ -141,7 +145,7 @@ | ||
141 | watch: { | 145 | watch: { |
142 | value (newVal) { | 146 | value (newVal) { |
143 | this.dates = newVal; | 147 | this.dates = newVal; |
144 | - this.panelDate = this.startDate || this.dates[0] || new Date(); | 148 | + this.panelDate = this.startDate || (this.multiple ? this.dates[this.dates.length - 1] : this.dates[0]) || new Date(); |
145 | }, | 149 | }, |
146 | currentView (currentView) { | 150 | currentView (currentView) { |
147 | this.$emit('on-selection-mode-change', currentView); | 151 | this.$emit('on-selection-mode-change', currentView); |
src/components/date-picker/picker.vue
@@ -47,6 +47,7 @@ | @@ -47,6 +47,7 @@ | ||
47 | :split-panels="splitPanels" | 47 | :split-panels="splitPanels" |
48 | :show-week-numbers="showWeekNumbers" | 48 | :show-week-numbers="showWeekNumbers" |
49 | :picker-type="type" | 49 | :picker-type="type" |
50 | + :multiple="multiple" | ||
50 | 51 | ||
51 | :time-picker-options="timePickerOptions" | 52 | :time-picker-options="timePickerOptions" |
52 | 53 |