mirror of
https://github.com/tenrok/vue2-datepicker.git
synced 2026-06-23 07:20:37 +03:00
feat: select-year and select-month (#290)
This commit is contained in:
@@ -106,6 +106,7 @@ export default {
|
|||||||
type: String,
|
type: String,
|
||||||
default: 'YYYY-MM-DD'
|
default: 'YYYY-MM-DD'
|
||||||
},
|
},
|
||||||
|
index: Number,
|
||||||
// below user set
|
// below user set
|
||||||
defaultValue: {
|
defaultValue: {
|
||||||
validator: function (val) {
|
validator: function (val) {
|
||||||
@@ -338,6 +339,7 @@ export default {
|
|||||||
if (this.type.toLowerCase() === 'year') {
|
if (this.type.toLowerCase() === 'year') {
|
||||||
return this.selectDate(new Date(this.now))
|
return this.selectDate(new Date(this.now))
|
||||||
}
|
}
|
||||||
|
this.dispatch('DatePicker', 'select-year', [year, this.index])
|
||||||
this.showPanelMonth()
|
this.showPanelMonth()
|
||||||
},
|
},
|
||||||
selectMonth (month) {
|
selectMonth (month) {
|
||||||
@@ -345,6 +347,7 @@ export default {
|
|||||||
if (this.type.toLowerCase() === 'month') {
|
if (this.type.toLowerCase() === 'month') {
|
||||||
return this.selectDate(new Date(this.now))
|
return this.selectDate(new Date(this.now))
|
||||||
}
|
}
|
||||||
|
this.dispatch('DatePicker', 'select-month', [month, this.index])
|
||||||
this.showPanelDate()
|
this.showPanelDate()
|
||||||
},
|
},
|
||||||
selectTime (time) {
|
selectTime (time) {
|
||||||
|
|||||||
@@ -67,6 +67,7 @@
|
|||||||
v-if="!range"
|
v-if="!range"
|
||||||
v-bind="$attrs"
|
v-bind="$attrs"
|
||||||
ref="calendarPanel"
|
ref="calendarPanel"
|
||||||
|
:index="-1"
|
||||||
:type="innerType"
|
:type="innerType"
|
||||||
:date-format="innerDateFormat"
|
:date-format="innerDateFormat"
|
||||||
:value="currentValue"
|
:value="currentValue"
|
||||||
@@ -79,6 +80,7 @@
|
|||||||
style="box-shadow:1px 0 rgba(0, 0, 0, .1)"
|
style="box-shadow:1px 0 rgba(0, 0, 0, .1)"
|
||||||
v-bind="$attrs"
|
v-bind="$attrs"
|
||||||
ref="calendarPanel"
|
ref="calendarPanel"
|
||||||
|
:index="0"
|
||||||
:type="innerType"
|
:type="innerType"
|
||||||
:date-format="innerDateFormat"
|
:date-format="innerDateFormat"
|
||||||
:value="currentValue[0]"
|
:value="currentValue[0]"
|
||||||
@@ -89,6 +91,7 @@
|
|||||||
@select-time="selectStartTime"></calendar-panel>
|
@select-time="selectStartTime"></calendar-panel>
|
||||||
<calendar-panel
|
<calendar-panel
|
||||||
v-bind="$attrs"
|
v-bind="$attrs"
|
||||||
|
:index="1"
|
||||||
:type="innerType"
|
:type="innerType"
|
||||||
:date-format="innerDateFormat"
|
:date-format="innerDateFormat"
|
||||||
:value="currentValue[1]"
|
:value="currentValue[1]"
|
||||||
|
|||||||
Reference in New Issue
Block a user