mirror of
https://github.com/tenrok/vue2-datepicker.git
synced 2026-06-05 19:42:27 +03:00
Add default empty array for disabledDays, add showYearNav prop
This commit is contained in:
@@ -47,5 +47,6 @@ export default {
|
||||
| placeholder | String | | input placeholder text |
|
||||
| width | String/Number | 210 | input size |
|
||||
| disabledDays | Array | [] | Days in YYYY-MM-DD format to disable |
|
||||
| showYearNav | Boolean | true | Show the year nav in the calendar |
|
||||
|
||||
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
<template>
|
||||
<div class="calendar">
|
||||
<div class="calendar-header">
|
||||
<a class="calendar__prev-icon" @click="changeYear(-1)">«</a>
|
||||
<a v-show="showYearNav" class="calendar__prev-icon" @click="changeYear(-1)">«</a>
|
||||
<a v-show="currentPanel === 'date'" class="calendar__prev-icon" @click="changeMonth(-1)">‹</a>
|
||||
<a class="calendar__next-icon" @click="changeYear(1)">»</a>
|
||||
<a v-show="showYearNav" class="calendar__next-icon" @click="changeYear(1)">»</a>
|
||||
<a v-show="currentPanel === 'date'" class="calendar__next-icon" @click="changeMonth(1)" >›</a>
|
||||
<a @click="showMonths">{{months[currentMonth]}}</a>
|
||||
<a @click="showYears">{{currentYear}}</a>
|
||||
@@ -41,7 +41,14 @@ export default {
|
||||
endAt: null,
|
||||
value: null,
|
||||
show: Boolean,
|
||||
disabledDays: Array
|
||||
disabledDays: {
|
||||
type: Array,
|
||||
default: []
|
||||
},
|
||||
showYearNav: {
|
||||
type: Boolean,
|
||||
default: true
|
||||
}
|
||||
},
|
||||
data () {
|
||||
const translation = this.$parent.translation
|
||||
|
||||
+11
-4
@@ -20,14 +20,14 @@
|
||||
ref="calendar"
|
||||
v-show="showPopup">
|
||||
<template v-if="!range">
|
||||
<calendar-panel @select="showPopup = false" v-model="currentValue" :show="showPopup" :disabledDays="disabledDays"></calendar-panel>
|
||||
<calendar-panel @select="showPopup = false" v-model="currentValue" :show="showPopup" :disabledDays="disabledDays" :showYearNav="showYearNav"></calendar-panel>
|
||||
</template>
|
||||
<template v-else>
|
||||
<div class="datepicker-top">
|
||||
<span v-for="range in ranges" @click="selectRange(range)">{{range.text}}</span>
|
||||
</div>
|
||||
<calendar-panel style="width:50%;box-shadow:1px 0 rgba(0, 0, 0, .1)" v-model="currentValue[0]" :end-at="currentValue[1]" :show="showPopup" :disabledDays="disabledDays"></calendar-panel>
|
||||
<calendar-panel style="width:50%;" v-model="currentValue[1]" :start-at="currentValue[0]" :show="showPopup" :disabledDays="disabledDays"></calendar-panel>
|
||||
<calendar-panel style="width:50%;box-shadow:1px 0 rgba(0, 0, 0, .1)" v-model="currentValue[0]" :end-at="currentValue[1]" :show="showPopup" :disabledDays="disabledDays" :showYearNav="showYearNav"></calendar-panel>
|
||||
<calendar-panel style="width:50%;" v-model="currentValue[1]" :start-at="currentValue[0]" :show="showPopup" :disabledDays="disabledDays" :showYearNav="showYearNav"></calendar-panel>
|
||||
</template>
|
||||
</div>
|
||||
</div>
|
||||
@@ -58,7 +58,14 @@ export default {
|
||||
default: 'zh'
|
||||
},
|
||||
value: null,
|
||||
disabledDays: Array
|
||||
disabledDays: {
|
||||
type: Array,
|
||||
default: []
|
||||
},
|
||||
showYearNav: {
|
||||
type: Boolean,
|
||||
default: true
|
||||
}
|
||||
},
|
||||
data () {
|
||||
return {
|
||||
|
||||
Reference in New Issue
Block a user