From 02859de9b12364ccb6201a026a70ce254053c025 Mon Sep 17 00:00:00 2001 From: Sergio Crisostomo Date: Mon, 5 Mar 2018 08:59:25 +0100 Subject: [PATCH] Use the last picked date as reference for the date panel --- src/components/date-picker/panel/Date/date.vue | 8 ++++++-- src/components/date-picker/picker.vue | 1 + 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/components/date-picker/panel/Date/date.vue b/src/components/date-picker/panel/Date/date.vue index 9a595b9..a5913b8 100644 --- a/src/components/date-picker/panel/Date/date.vue +++ b/src/components/date-picker/panel/Date/date.vue @@ -92,7 +92,11 @@ mixins: [ Mixin, Locale, DateMixin ], components: { Icon, DateTable, YearTable, MonthTable, TimePicker, Confirm, datePanelLabel }, props: { - // in the mixin + // more props in the mixin + multiple: { + type: Boolean, + default: false + } }, data () { const {selectionMode, value} = this; @@ -141,7 +145,7 @@ watch: { value (newVal) { this.dates = newVal; - this.panelDate = this.startDate || this.dates[0] || new Date(); + this.panelDate = this.startDate || (this.multiple ? this.dates[this.dates.length - 1] : this.dates[0]) || new Date(); }, currentView (currentView) { this.$emit('on-selection-mode-change', currentView); diff --git a/src/components/date-picker/picker.vue b/src/components/date-picker/picker.vue index 38fd92b..61aa3ca 100644 --- a/src/components/date-picker/picker.vue +++ b/src/components/date-picker/picker.vue @@ -47,6 +47,7 @@ :split-panels="splitPanels" :show-week-numbers="showWeekNumbers" :picker-type="type" + :multiple="multiple" :time-picker-options="timePickerOptions" -- libgit2 0.21.4