Skip to content

Commit

Permalink
feat: select-year and select-month (#290)
Browse files Browse the repository at this point in the history
  • Loading branch information
mengxiong10 committed Apr 9, 2019
1 parent 002a1ac commit 20d1f19
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/calendar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ export default {
type: String,
default: 'YYYY-MM-DD'
},
index: Number,
// below user set
defaultValue: {
validator: function (val) {
Expand Down Expand Up @@ -338,13 +339,15 @@ export default {
if (this.type.toLowerCase() === 'year') {
return this.selectDate(new Date(this.now))
}
this.dispatch('DatePicker', 'select-year', [year, this.index])
this.showPanelMonth()
},
selectMonth (month) {
this.changeCalendarMonth(month)
if (this.type.toLowerCase() === 'month') {
return this.selectDate(new Date(this.now))
}
this.dispatch('DatePicker', 'select-month', [month, this.index])
this.showPanelDate()
},
selectTime (time) {
Expand Down
3 changes: 3 additions & 0 deletions src/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@
v-if="!range"
v-bind="$attrs"
ref="calendarPanel"
:index="-1"
:type="innerType"
:date-format="innerDateFormat"
:value="currentValue"
Expand All @@ -79,6 +80,7 @@
style="box-shadow:1px 0 rgba(0, 0, 0, .1)"
v-bind="$attrs"
ref="calendarPanel"
:index="0"
:type="innerType"
:date-format="innerDateFormat"
:value="currentValue[0]"
Expand All @@ -89,6 +91,7 @@
@select-time="selectStartTime"></calendar-panel>
<calendar-panel
v-bind="$attrs"
:index="1"
:type="innerType"
:date-format="innerDateFormat"
:value="currentValue[1]"
Expand Down

0 comments on commit 20d1f19

Please sign in to comment.