Commit d609ba86825d727544bb66b8ea4680916c0ebc14

Authored by 梁灏
1 parent 456877a1

update TimePicker

update TimePicker
src/components/date-picker/picker.vue
... ... @@ -417,7 +417,6 @@
417 417  
418 418 let newDate = formatter(date, format);
419 419 if (type === 'daterange' || type === 'timerange') {
420   - console.log(newDate);
421 420 newDate = [newDate.split(RANGE_SEPARATOR)[0], newDate.split(RANGE_SEPARATOR)[1]];
422 421 }
423 422  
... ... @@ -445,12 +444,13 @@
445 444 immediate: true,
446 445 handler (val) {
447 446 const type = this.type;
448   - if (type === 'time' || type === 'timerange') {
  447 + if ((type === 'time' || type === 'timerange') && !(val instanceof Date)) {
449 448 const parser = (
450 449 TYPE_VALUE_RESOLVER_MAP[type] ||
451 450 TYPE_VALUE_RESOLVER_MAP['default']
452 451 ).parser;
453 452 if (type === 'timerange') val = val.join(RANGE_SEPARATOR);
  453 +
454 454 val = parser(val, this.format || DEFAULT_FORMATS[type]);
455 455 }
456 456 this.internalValue = val;
... ...
test/routers/date.vue
... ... @@ -6,7 +6,7 @@
6 6 <template>
7 7 <row>
8 8 <i-col span="12">
9   - <!--<date-picker type="date" placeholder="选择日期" style="width: 200px" @on-ok="ok" confirm @on-clear="clear"></date-picker>-->
  9 + <date-picker type="date" placeholder="选择日期" style="width: 200px" @on-ok="ok" confirm @on-clear="clear"></date-picker>
10 10 </i-col>
11 11 <i-col span="12">
12 12 <date-picker :value="value3" type="daterange" placement="bottom-start" placeholder="选择日期" style="width: 200px"></date-picker>
... ... @@ -40,7 +40,7 @@
40 40 export default {
41 41 data () {
42 42 return {
43   -// value: '2016-12-12 03:03:03'
  43 +// value: '2016-12-12 03:03:03',
44 44 value: '15:12:01',
45 45 value2: ['08:40:00', '09:40:00'],
46 46 // value2: [new Date(), new Date()],
... ... @@ -50,7 +50,7 @@
50 50 methods: {
51 51 c (s) {
52 52 console.log(1,s);
53   - this.value = s;
  53 + this.value2 = s;
54 54 },
55 55 ok () {
56 56 console.log('ok');
... ...