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,17 +2,17 @@ | ||
2 | <div :class="classes"> | 2 | <div :class="classes"> |
3 | <div :class="[prefixCls+ '-list']" v-el:hours> | 3 | <div :class="[prefixCls+ '-list']" v-el:hours> |
4 | <ul @click="handleClickHours"> | 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 | </ul> | 6 | </ul> |
7 | </div> | 7 | </div> |
8 | <div :class="[prefixCls+ '-list']" v-el:minutes> | 8 | <div :class="[prefixCls+ '-list']" v-el:minutes> |
9 | <ul @click="handleClickMinutes"> | 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 | </ul> | 11 | </ul> |
12 | </div> | 12 | </div> |
13 | <div :class="[prefixCls+ '-list']" v-show="showSeconds" v-el:seconds> | 13 | <div :class="[prefixCls+ '-list']" v-show="showSeconds" v-el:seconds> |
14 | <ul @click="handleClickSeconds"> | 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 | </ul> | 16 | </ul> |
17 | </div> | 17 | </div> |
18 | </div> | 18 | </div> |
@@ -185,6 +185,9 @@ | @@ -185,6 +185,9 @@ | ||
185 | }); | 185 | }); |
186 | this.$nextTick(() => times.forEach(type => this.$els[type].style.overflow = 'auto')); | 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 | watch: { | 193 | watch: { |