Commit c1abaed9807c185b28d34cf8175f63754c8a7cb8
1 parent
9d844d53
update TimePicker
update TimePicker
Showing
3 changed files
with
38 additions
and
29 deletions
Show diff stats
src/components/date-picker/panel/time.vue
| ... | ... | @@ -37,7 +37,11 @@ |
| 37 | 37 | value: '', |
| 38 | 38 | hours: 0, |
| 39 | 39 | minutes: 0, |
| 40 | - seconds: 0 | |
| 40 | + seconds: 0, | |
| 41 | + disabledHours: [], | |
| 42 | + disabledMinutes: [], | |
| 43 | + disabledSeconds: [], | |
| 44 | + hideDisabledOptions: false | |
| 41 | 45 | }; |
| 42 | 46 | }, |
| 43 | 47 | computed: { |
| ... | ... | @@ -51,11 +55,11 @@ |
| 51 | 55 | newVal = new Date(newVal); |
| 52 | 56 | if (!isNaN(newVal)) { |
| 53 | 57 | this.handleChange({ |
| 54 | - hours: date.getHours(), | |
| 55 | - minutes: date.getMinutes(), | |
| 56 | - seconds: date.getSeconds() | |
| 58 | + hours: newVal.getHours(), | |
| 59 | + minutes: newVal.getMinutes(), | |
| 60 | + seconds: newVal.getSeconds() | |
| 57 | 61 | }); |
| 58 | - this.$nextTick(_ => this.scrollTop()); | |
| 62 | + this.$nextTick(() => this.scrollTop()); | |
| 59 | 63 | } |
| 60 | 64 | } |
| 61 | 65 | }, | ... | ... |
src/components/date-picker/picker/time-picker.js
| 1 | 1 | import Picker from '../picker.vue'; |
| 2 | 2 | import TimePanel from '../panel/time.vue'; |
| 3 | +import Options from '../time-mixins'; | |
| 3 | 4 | |
| 4 | 5 | export default { |
| 5 | - mixins: [Picker], | |
| 6 | + mixins: [Picker, Options], | |
| 6 | 7 | props: { |
| 7 | - value: {}, | |
| 8 | - disabledHours: { | |
| 9 | - type: Array, | |
| 10 | - default () { | |
| 11 | - return []; | |
| 12 | - } | |
| 13 | - }, | |
| 14 | - disabledMinutes: { | |
| 15 | - type: Array, | |
| 16 | - default () { | |
| 17 | - return []; | |
| 18 | - } | |
| 19 | - }, | |
| 20 | - disabledSeconds: { | |
| 21 | - type: Array, | |
| 22 | - default () { | |
| 23 | - return []; | |
| 24 | - } | |
| 25 | - }, | |
| 26 | - hideDisabledOptions: { | |
| 27 | - type: Boolean, | |
| 28 | - default: false | |
| 29 | - } | |
| 8 | + value: {} | |
| 30 | 9 | }, |
| 31 | 10 | data () { |
| 32 | 11 | return { | ... | ... |
| 1 | +export default { | |
| 2 | + props: { | |
| 3 | + disabledHours: { | |
| 4 | + type: Array, | |
| 5 | + default () { | |
| 6 | + return []; | |
| 7 | + } | |
| 8 | + }, | |
| 9 | + disabledMinutes: { | |
| 10 | + type: Array, | |
| 11 | + default () { | |
| 12 | + return []; | |
| 13 | + } | |
| 14 | + }, | |
| 15 | + disabledSeconds: { | |
| 16 | + type: Array, | |
| 17 | + default () { | |
| 18 | + return []; | |
| 19 | + } | |
| 20 | + }, | |
| 21 | + hideDisabledOptions: { | |
| 22 | + type: Boolean, | |
| 23 | + default: false | |
| 24 | + } | |
| 25 | + } | |
| 26 | +}; | |
| 0 | 27 | \ No newline at end of file | ... | ... |