9d844d53
梁灏
fixed Layout bug
|
1
2
3
4
5
|
<template>
<div :class="[prefixCls + '-body-wrapper']">
<div :class="[prefixCls + '-body']">
<div :class="[prefixCls + '-content']">
<time-spinner
|
5cc9b892
梁灏
update DateTimePi...
|
6
|
v-ref:time-spinner
|
9d844d53
梁灏
fixed Layout bug
|
7
8
9
10
|
:show-seconds="showSeconds"
:hours="hours"
:minutes="minutes"
:seconds="seconds"
|
36628aca
梁灏
update TimePicker
|
11
12
13
14
|
:disabled-hours="disabledHours"
:disabled-minutes="disabledMinutes"
:disabled-seconds="disabledSeconds"
:hide-disabled-options="hideDisabledOptions"
|
9d844d53
梁灏
fixed Layout bug
|
15
16
17
18
|
@on-change="handleChange"
@on-pick-click="handlePickClick"></time-spinner>
</div>
<Confirm
|
d596b9e4
梁灏
update TimePicker
|
19
|
v-if="confirm"
|
9d844d53
梁灏
fixed Layout bug
|
20
21
22
23
24
25
26
27
28
29
30
|
@on-pick-clear="handlePickClear"
@on-pick-success="handlePickSuccess"></Confirm>
</div>
</div>
</template>
<script>
import TimeSpinner from '../base/time-spinner.vue';
import Confirm from '../base/confirm.vue';
import Mixin from './mixin';
|
2dbbd7de
梁灏
update TimePicker
|
31
32
|
import { initTimeDate } from '../util';
|
9d844d53
梁灏
fixed Layout bug
|
33
34
35
36
37
38
|
const prefixCls = 'ivu-picker-panel';
const timePrefixCls = 'ivu-time-picker';
export default {
mixins: [Mixin],
components: { TimeSpinner, Confirm },
|
5cc9b892
梁灏
update DateTimePi...
|
39
40
41
42
43
44
45
46
47
48
|
props: {
date: {
default () {
return initTimeDate()
}
},
value: {
default: ''
}
},
|
9d844d53
梁灏
fixed Layout bug
|
49
50
51
52
53
|
data () {
return {
prefixCls: prefixCls,
timePrefixCls: timePrefixCls,
format: 'HH:mm:ss',
|
2dbbd7de
梁灏
update TimePicker
|
54
55
56
|
hours: '',
minutes: '',
seconds: '',
|
c1abaed9
梁灏
update TimePicker
|
57
58
59
|
disabledHours: [],
disabledMinutes: [],
disabledSeconds: [],
|
d596b9e4
梁灏
update TimePicker
|
60
61
|
hideDisabledOptions: false,
confirm: false
|
9d844d53
梁灏
fixed Layout bug
|
62
63
64
65
66
67
68
69
70
71
72
73
|
};
},
computed: {
showSeconds () {
return (this.format || '').indexOf('ss') !== -1;
}
},
watch: {
value (newVal) {
if (!newVal) return;
newVal = new Date(newVal);
if (!isNaN(newVal)) {
|
603e437b
梁灏
update TimePicker
|
74
|
this.date = newVal;
|
9d844d53
梁灏
fixed Layout bug
|
75
|
this.handleChange({
|
c1abaed9
梁灏
update TimePicker
|
76
77
78
|
hours: newVal.getHours(),
minutes: newVal.getMinutes(),
seconds: newVal.getSeconds()
|
603e437b
梁灏
update TimePicker
|
79
|
}, false);
|
9d844d53
梁灏
fixed Layout bug
|
80
81
82
83
|
}
}
},
methods: {
|
2dbbd7de
梁灏
update TimePicker
|
84
85
86
87
88
|
handleClear() {
this.date = initTimeDate();
this.hours = '';
this.minutes = '';
this.seconds = '';
|
2dbbd7de
梁灏
update TimePicker
|
89
|
},
|
603e437b
梁灏
update TimePicker
|
90
|
handleChange (date, emit = true) {
|
9d844d53
梁灏
fixed Layout bug
|
91
92
93
94
95
96
97
98
99
100
101
102
|
if (date.hours !== undefined) {
this.date.setHours(date.hours);
this.hours = this.date.getHours();
}
if (date.minutes !== undefined) {
this.date.setMinutes(date.minutes);
this.minutes = this.date.getMinutes();
}
if (date.seconds !== undefined) {
this.date.setSeconds(date.seconds);
this.seconds = this.date.getSeconds();
}
|
603e437b
梁灏
update TimePicker
|
103
|
if (emit) this.$emit('on-pick', this.date, true);
|
5cc9b892
梁灏
update DateTimePi...
|
104
105
106
|
},
updateScroll () {
this.$refs.timeSpinner.updateScroll();
|
9d844d53
梁灏
fixed Layout bug
|
107
108
109
110
|
}
}
};
</script>
|