Commit 4db5926d6bdce63ef447653b4dd580ede3017cc2

Authored by 梁灏
1 parent b27687d3

fixed #153

fixed #153
src/components/date-picker/base/time-spinner.vue
1 <template> 1 <template>
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 :class="[prefixCls + '-ul']" @click="handleClickHours">
5 <li :class="getCellCls(item)" v-for="item in hoursList" v-show="!item.hide" :index="$index">{{ formatTime(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 :class="[prefixCls + '-ul']" @click="handleClickMinutes">
10 <li :class="getCellCls(item)" v-for="item in minutesList" v-show="!item.hide" :index="$index">{{ formatTime(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 :class="[prefixCls + '-ul']" @click="handleClickSeconds">
15 <li :class="getCellCls(item)" v-for="item in secondsList" v-show="!item.hide" :index="$index">{{ formatTime(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>
@@ -155,11 +155,8 @@ @@ -155,11 +155,8 @@
155 const data = {}; 155 const data = {};
156 data[type] = cell.text; 156 data[type] = cell.text;
157 this.$emit('on-change', data); 157 this.$emit('on-change', data);
158 -  
159 -// const from = this.$els[type].scrollTop;  
160 -// const to = 24 * this.getScrollIndex(type, cell.text);  
161 -// scrollTop(this.$els[type], from, to, 500);  
162 } 158 }
  159 + this.$emit('on-pick-click');
163 }, 160 },
164 scroll (type, index) { 161 scroll (type, index) {
165 const from = this.$els[type].scrollTop; 162 const from = this.$els[type].scrollTop;
src/components/date-picker/picker.vue
@@ -449,9 +449,9 @@ @@ -449,9 +449,9 @@
449 TYPE_VALUE_RESOLVER_MAP['default'] 449 TYPE_VALUE_RESOLVER_MAP['default']
450 ).parser; 450 ).parser;
451 451
452 - if (type === 'time' && !(val instanceof Date)) { 452 + if (val && type === 'time' && !(val instanceof Date)) {
453 val = parser(val, this.format || DEFAULT_FORMATS[type]); 453 val = parser(val, this.format || DEFAULT_FORMATS[type]);
454 - } else if (type === 'timerange' && Array.isArray(val) && val.length === 2 && !(val[0] instanceof Date) && !(val[1] instanceof Date)) { 454 + } else if (val && type === 'timerange' && Array.isArray(val) && val.length === 2 && !(val[0] instanceof Date) && !(val[1] instanceof Date)) {
455 val = val.join(RANGE_SEPARATOR); 455 val = val.join(RANGE_SEPARATOR);
456 val = parser(val, this.format || DEFAULT_FORMATS[type]); 456 val = parser(val, this.format || DEFAULT_FORMATS[type]);
457 } 457 }
src/styles/mixins/layout.less
@@ -48,13 +48,13 @@ @@ -48,13 +48,13 @@
48 } 48 }
49 49
50 .loop-grid-columns(@index, @class) when (@index = 0) { 50 .loop-grid-columns(@index, @class) when (@index = 0) {
51 - .@{col-prefix-cls}@{class}-@{index} { 51 + .@{col-prefix-cls}-span@{class}-@{index} {
52 display: none; 52 display: none;
53 } 53 }
54 - .@{col-prefix-cls}-push-@{index} { 54 + .@{col-prefix-cls}@{class}-push-@{index} {
55 left: auto; 55 left: auto;
56 } 56 }
57 - .@{col-prefix-cls}-pull-@{index} { 57 + .@{col-prefix-cls}@{class}-pull-@{index} {
58 right: auto; 58 right: auto;
59 } 59 }
60 } 60 }
test/routers/date.vue
@@ -24,16 +24,17 @@ @@ -24,16 +24,17 @@
24 <!--style="width: 168px"></time-picker>--> 24 <!--style="width: 168px"></time-picker>-->
25 <!--</i-col>--> 25 <!--</i-col>-->
26 <i-col span="12"> 26 <i-col span="12">
27 - <time-picker  
28 - :value="value2"  
29 - type="timerange"  
30 - placeholder="选择时间"  
31 - format="HH:mm:ss"  
32 - :hide-disabled-options="false"  
33 - @on-change="c"  
34 - @on-ok="ok"  
35 - @on-clear="clear"  
36 - style="width: 168px"></time-picker> 27 + <Time-picker type="time" :value="value" placeholder="选择时间" style="width: 168px"></Time-picker>
  28 + <!--<time-picker-->
  29 + <!--:value="value2"-->
  30 + <!--type="timerange"-->
  31 + <!--placeholder="选择时间"-->
  32 + <!--format="HH:mm:ss"-->
  33 + <!--:hide-disabled-options="false"-->
  34 + <!--@on-change="c"-->
  35 + <!--@on-ok="ok"-->
  36 + <!--@on-clear="clear"-->
  37 + <!--style="width: 168px"></time-picker>-->
37 </i-col> 38 </i-col>
38 </row> 39 </row>
39 </template> 40 </template>
test/routers/more.vue
@@ -4,25 +4,13 @@ @@ -4,25 +4,13 @@
4 } 4 }
5 </style> 5 </style>
6 <template> 6 <template>
7 - {{properties|json}}<br>  
8 - {{units|json}}  
9 - <Checkbox-group :model.sync="properties">  
10 - <Checkbox v-for="unit in units" :value="unit.UnitName"></Checkbox>  
11 - </Checkbox-group>  
12 - <Back-top></Back-top> 7 + <row>
  8 + <i-col span="0">123</i-col>
  9 + <i-col span="24">24</i-col>
  10 + </row>
13 </template> 11 </template>
14 <script> 12 <script>
15 export default { 13 export default {
16 - data () {  
17 - return {  
18 - properties: [],  
19 - units: []  
20 - }  
21 - },  
22 - ready () {  
23 - setTimeout(() => {  
24 - this.units = [{UnitName:"件"},{UnitName:"箱"},{UnitName:"双"}];  
25 - }, 1000);  
26 - } 14 +
27 } 15 }
28 </script> 16 </script>