vue-datepicker-local
vue-datepicker-local copied to clipboard
format="YYYY-MM-DD HH:mm",日历时分选择框不能显示
只想年月日时分,然后就出现下面的不能选择时分,
+1
The issue is located at src/VueDatepickerLocalCalendar.vue:44
<div :class="`${pre}-foot`" v-if="m==='H'">
<div :class="`${pre}-hour`">
<a :title="local.hourTip" @click="showHours=!showHours,showMinutes=showSeconds=false" :class="{on:showHours}">{{hour|dd}}</a>
<span>:</span>
<a :title="local.minuteTip" @click="showMinutes=!showMinutes,showHours=showSeconds=false" :class="{on:showMinutes}">{{minute|dd}}</a>
<span>:</span>
<a :title="local.secondTip" @click="showSeconds=!showSeconds,showHours=showMinutes=false" :class="{on:showSeconds}">{{second|dd}}</a>
</div>
And here:
mounted () {
const $this = this
const is = c => $this.format.indexOf(c) !== -1
if (is('s') && is('m') && (is('h') || is('H'))) {
$this.m = 'H'
} else if (is('D')) {
$this.m = 'D'
} else if (is('M')) {
$this.m = 'M'
$this.showMonths = true
} else if (is('Y')) {
$this.m = 'Y'
$this.showYears = true
}
}
It could be something like:
<div :class="`${pre}-foot`" v-if="m==='H'">
<div :class="`${pre}-hour`">
<a v-if="is('h') || is('H')" :title="local.hourTip" @click="showHours=!showHours,showMinutes=showSeconds=false" :class="{on:showHours}">{{hour|dd}}</a>
<span v-if="(is('h') || is('H')) && is('m')">:</span>
<a v-if="is('m')" :title="local.minuteTip" @click="showMinutes=!showMinutes,showHours=showSeconds=false" :class="{on:showMinutes}">{{minute|dd}}</a>
<span v-if="is('m') && is('s')">:</span>
<a v-if="is('s')" :title="local.secondTip" @click="showSeconds=!showSeconds,showHours=showMinutes=false" :class="{on:showSeconds}">{{second|dd}}</a>
</div>
And here:
mounted () {
const $this = this
const is = c => $this.format.indexOf(c) !== -1
if (is('s') || is('m') || is('h') || is('H')) {
$this.m = 'H'
} else if (is('D')) {
$this.m = 'D'
} else if (is('M')) {
$this.m = 'M'
$this.showMonths = true
} else if (is('Y')) {
$this.m = 'Y'
$this.showYears = true
}
}