2
0
mirror of https://github.com/tenrok/vue2-datepicker.git synced 2026-06-07 15:02:27 +03:00

feat: select-year and select-month (#290)

This commit is contained in:
mengxiong10
2019-04-09 20:00:05 +08:00
parent 002a1acd23
commit 20d1f19c2d
2 changed files with 6 additions and 0 deletions
+3
View File
@@ -106,6 +106,7 @@ export default {
type: String,
default: 'YYYY-MM-DD'
},
index: Number,
// below user set
defaultValue: {
validator: function (val) {
@@ -338,6 +339,7 @@ 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) {
@@ -345,6 +347,7 @@ export default {
if (this.type.toLowerCase() === 'month') {
return this.selectDate(new Date(this.now))
}
this.dispatch('DatePicker', 'select-month', [month, this.index])
this.showPanelDate()
},
selectTime (time) {
+3
View File
@@ -67,6 +67,7 @@
v-if="!range"
v-bind="$attrs"
ref="calendarPanel"
:index="-1"
:type="innerType"
:date-format="innerDateFormat"
:value="currentValue"
@@ -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]"
@@ -89,6 +91,7 @@
@select-time="selectStartTime"></calendar-panel>
<calendar-panel
v-bind="$attrs"
:index="1"
:type="innerType"
:date-format="innerDateFormat"
:value="currentValue[1]"