Commit 4db5926d6bdce63ef447653b4dd580ede3017cc2

Authored by 梁灏
1 parent b27687d3

fixed #153

fixed #153
src/components/date-picker/base/time-spinner.vue
1 1 <template>
2 2 <div :class="classes">
3 3 <div :class="[prefixCls+ '-list']" v-el:hours>
4   - <ul @click="handleClickHours">
  4 + <ul :class="[prefixCls + '-ul']" @click="handleClickHours">
5 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   - <ul @click="handleClickMinutes">
  9 + <ul :class="[prefixCls + '-ul']" @click="handleClickMinutes">
10 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   - <ul @click="handleClickSeconds">
  14 + <ul :class="[prefixCls + '-ul']" @click="handleClickSeconds">
15 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>
... ... @@ -155,11 +155,8 @@
155 155 const data = {};
156 156 data[type] = cell.text;
157 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 161 scroll (type, index) {
165 162 const from = this.$els[type].scrollTop;
... ...
src/components/date-picker/picker.vue
... ... @@ -449,9 +449,9 @@
449 449 TYPE_VALUE_RESOLVER_MAP['default']
450 450 ).parser;
451 451  
452   - if (type === 'time' && !(val instanceof Date)) {
  452 + if (val && type === 'time' && !(val instanceof Date)) {
453 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 455 val = val.join(RANGE_SEPARATOR);
456 456 val = parser(val, this.format || DEFAULT_FORMATS[type]);
457 457 }
... ...
src/styles/mixins/layout.less
... ... @@ -48,13 +48,13 @@
48 48 }
49 49  
50 50 .loop-grid-columns(@index, @class) when (@index = 0) {
51   - .@{col-prefix-cls}@{class}-@{index} {
  51 + .@{col-prefix-cls}-span@{class}-@{index} {
52 52 display: none;
53 53 }
54   - .@{col-prefix-cls}-push-@{index} {
  54 + .@{col-prefix-cls}@{class}-push-@{index} {
55 55 left: auto;
56 56 }
57   - .@{col-prefix-cls}-pull-@{index} {
  57 + .@{col-prefix-cls}@{class}-pull-@{index} {
58 58 right: auto;
59 59 }
60 60 }
... ...
test/routers/date.vue
... ... @@ -24,16 +24,17 @@
24 24 <!--style="width: 168px"></time-picker>-->
25 25 <!--</i-col>-->
26 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 38 </i-col>
38 39 </row>
39 40 </template>
... ...
test/routers/more.vue
... ... @@ -4,25 +4,13 @@
4 4 }
5 5 </style>
6 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 11 </template>
14 12 <script>
15 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 16 </script>
... ...