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:
@@ -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) {
|
||||
|
||||
@@ -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]"
|
||||
|
||||
Reference in New Issue
Block a user