support DatePicker & TimePicker

support DatePicker & TimePicker
This commit is contained in:
梁灏 2017-03-07 18:06:56 +08:00
parent 5b19b5f55f
commit 531cd1654b
19 changed files with 265 additions and 79 deletions

View file

@ -42,7 +42,7 @@
@on-pick="handleRangePick"
@on-pick-click="handlePickClick"></date-table>
<year-table
v-ref:left-year-table
ref="leftYearTable"
v-show="leftCurrentView === 'year'"
:year="leftTableYear"
:date="leftTableDate"
@ -51,7 +51,7 @@
@on-pick="handleLeftYearPick"
@on-pick-click="handlePickClick"></year-table>
<month-table
v-ref:left-month-table
ref="leftMonthTable"
v-show="leftCurrentView === 'month'"
:month="leftMonth"
:date="leftTableDate"
@ -95,7 +95,7 @@
@on-pick="handleRangePick"
@on-pick-click="handlePickClick"></date-table>
<year-table
v-ref:right-year-table
ref="rightYearTable"
v-show="rightCurrentView === 'year'"
:year="rightTableYear"
:date="rightTableDate"
@ -104,7 +104,7 @@
@on-pick="handleRightYearPick"
@on-pick-click="handlePickClick"></year-table>
<month-table
v-ref:right-month-table
ref="rightMonthTable"
v-show="rightCurrentView === 'month'"
:month="rightMonth"
:date="rightTableDate"
@ -115,7 +115,7 @@
</div>
<div :class="[prefixCls + '-content']" v-show="isTime">
<time-picker
v-ref:time-picker
ref="timePicker"
v-show="isTime"
@on-pick="handleTimePick"
@on-pick-click="handlePickClick"></time-picker>
@ -407,7 +407,7 @@
this.handleConfirm(false);
}
},
compiled () {
mounted () {
if (this.showTime) {
// todo
this.$refs.timePicker.date = this.minDate;

View file

@ -42,7 +42,7 @@
@on-pick="handleDatePick"
@on-pick-click="handlePickClick"></date-table>
<year-table
v-ref:year-table
ref="yearTable"
v-show="currentView === 'year'"
:year="year"
:date="date"
@ -51,7 +51,7 @@
@on-pick="handleYearPick"
@on-pick-click="handlePickClick"></year-table>
<month-table
v-ref:month-table
ref="monthTable"
v-show="currentView === 'month'"
:month="month"
:date="date"
@ -60,7 +60,7 @@
@on-pick="handleMonthPick"
@on-pick-click="handlePickClick"></month-table>
<time-picker
v-ref:time-picker
ref="timePicker"
show-date
v-show="currentView === 'time'"
@on-pick="handleTimePick"
@ -272,7 +272,7 @@
this.handleDatePick(date);
}
},
compiled () {
mounted () {
if (this.selectionMode === 'month') {
this.currentView = 'month';
}

View file

@ -7,7 +7,7 @@
<template v-else>{{ t('i.datepicker.startTime') }}</template>
</div>
<time-spinner
v-ref:time-spinner
ref="timeSpinner"
:show-seconds="showSeconds"
:hours="hours"
:minutes="minutes"
@ -25,7 +25,7 @@
<template v-else>{{ t('i.datepicker.endTime') }}</template>
</div>
<time-spinner
v-ref:time-spinner-end
ref="timeSpinnerEnd"
:show-seconds="showSeconds"
:hours="hoursEnd"
:minutes="minutesEnd"
@ -200,7 +200,7 @@
this.$refs.timeSpinnerEnd.updateScroll();
}
},
compiled () {
mounted () {
if (this.$parent && this.$parent.$options.name === 'DatePicker') this.showDate = true;
}
};

View file

@ -4,7 +4,7 @@
<div :class="[timePrefixCls + '-header']" v-if="showDate">{{ visibleDate }}</div>
<div :class="[prefixCls + '-content']">
<time-spinner
v-ref:time-spinner
ref="timeSpinner"
:show-seconds="showSeconds"
:hours="hours"
:minutes="minutes"
@ -108,7 +108,7 @@
this.$refs.timeSpinner.updateScroll();
}
},
compiled () {
mounted () {
if (this.$parent && this.$parent.$options.name === 'DatePicker') this.showDate = true;
}
};