Commit 63bd0f7d3fda0cb15a6f83705f8c71ed2c7108f1
1 parent
4c683651
Add start-date prop to force placing of date picker in date
Showing
4 changed files
with
12 additions
and
3 deletions
Show diff stats
src/components/date-picker/panel/Date/date-panel-mixin.js
src/components/date-picker/panel/Date/date-range.vue
... | ... | @@ -129,14 +129,16 @@ |
129 | 129 | }, |
130 | 130 | data(){ |
131 | 131 | const [minDate, maxDate] = this.value.map(date => date || initTimeDate()); |
132 | + const leftPanelDate = this.startDate ? this.startDate : minDate; | |
133 | + | |
132 | 134 | return { |
133 | 135 | prefixCls: prefixCls, |
134 | 136 | datePrefixCls: datePrefixCls, |
135 | 137 | dates: this.value, |
136 | 138 | rangeState: {from: this.value[0], to: this.value[1], selecting: minDate && !maxDate}, |
137 | 139 | currentView: this.selectionMode || 'range', |
138 | - leftPanelDate: minDate, | |
139 | - rightPanelDate: new Date(minDate.getFullYear(), minDate.getMonth() + 1, minDate.getDate()) | |
140 | + leftPanelDate: leftPanelDate, | |
141 | + rightPanelDate: new Date(leftPanelDate.getFullYear(), leftPanelDate.getMonth() + 1, leftPanelDate.getDate()) | |
140 | 142 | }; |
141 | 143 | }, |
142 | 144 | computed: { | ... | ... |
src/components/date-picker/panel/Date/date.vue
src/components/date-picker/picker.vue
... | ... | @@ -39,6 +39,7 @@ |
39 | 39 | :steps="steps" |
40 | 40 | :format="format" |
41 | 41 | :value="internalValue" |
42 | + :start-date="startDate" | |
42 | 43 | |
43 | 44 | v-bind="ownPickerProps" |
44 | 45 | |
... | ... | @@ -204,6 +205,9 @@ |
204 | 205 | type: Boolean, |
205 | 206 | default: false |
206 | 207 | }, |
208 | + startDate: { | |
209 | + type: Date | |
210 | + }, | |
207 | 211 | size: { |
208 | 212 | validator (value) { |
209 | 213 | return oneOf(value, ['small', 'large', 'default']); | ... | ... |