Commit b27687d35f0c2fcb05163de9273fce78f3c294eb
1 parent
db9985a9
update TimePicker
update TimePicker
Showing
1 changed file
with
6 additions
and
3 deletions
Show diff stats
src/components/date-picker/base/time-spinner.vue
... | ... | @@ -2,17 +2,17 @@ |
2 | 2 | <div :class="classes"> |
3 | 3 | <div :class="[prefixCls+ '-list']" v-el:hours> |
4 | 4 | <ul @click="handleClickHours"> |
5 | - <li :class="getCellCls(item)" v-for="item in hoursList" v-show="!item.hide" :index="$index">{{ item.text < 10 ? '0' + item.text : item.text }}</li> | |
5 | + <li :class="getCellCls(item)" v-for="item in hoursList" v-show="!item.hide" :index="$index">{{ formatTime(item.text) }}</li> | |
6 | 6 | </ul> |
7 | 7 | </div> |
8 | 8 | <div :class="[prefixCls+ '-list']" v-el:minutes> |
9 | 9 | <ul @click="handleClickMinutes"> |
10 | - <li :class="getCellCls(item)" v-for="item in minutesList" v-show="!item.hide" :index="$index">{{ item.text < 10 ? '0' + item.text : item.text }}</li> | |
10 | + <li :class="getCellCls(item)" v-for="item in minutesList" v-show="!item.hide" :index="$index">{{ formatTime(item.text) }}</li> | |
11 | 11 | </ul> |
12 | 12 | </div> |
13 | 13 | <div :class="[prefixCls+ '-list']" v-show="showSeconds" v-el:seconds> |
14 | 14 | <ul @click="handleClickSeconds"> |
15 | - <li :class="getCellCls(item)" v-for="item in secondsList" v-show="!item.hide" :index="$index">{{ item.text < 10 ? '0' + item.text : item.text }}</li> | |
15 | + <li :class="getCellCls(item)" v-for="item in secondsList" v-show="!item.hide" :index="$index">{{ formatTime(item.text) }}</li> | |
16 | 16 | </ul> |
17 | 17 | </div> |
18 | 18 | </div> |
... | ... | @@ -185,6 +185,9 @@ |
185 | 185 | }); |
186 | 186 | this.$nextTick(() => times.forEach(type => this.$els[type].style.overflow = 'auto')); |
187 | 187 | }); |
188 | + }, | |
189 | + formatTime (text) { | |
190 | + return text < 10 ? '0' + text : text; | |
188 | 191 | } |
189 | 192 | }, |
190 | 193 | watch: { | ... | ... |