From c1abaed9807c185b28d34cf8175f63754c8a7cb8 Mon Sep 17 00:00:00 2001 From: 梁灏 Date: Mon, 26 Dec 2016 15:04:02 +0800 Subject: [PATCH] update TimePicker --- src/components/date-picker/panel/time.vue | 14 +++++++++----- src/components/date-picker/picker/time-picker.js | 27 +++------------------------ src/components/date-picker/time-mixins.js | 26 ++++++++++++++++++++++++++ 3 files changed, 38 insertions(+), 29 deletions(-) create mode 100644 src/components/date-picker/time-mixins.js diff --git a/src/components/date-picker/panel/time.vue b/src/components/date-picker/panel/time.vue index 452776f..2f50672 100644 --- a/src/components/date-picker/panel/time.vue +++ b/src/components/date-picker/panel/time.vue @@ -37,7 +37,11 @@ value: '', hours: 0, minutes: 0, - seconds: 0 + seconds: 0, + disabledHours: [], + disabledMinutes: [], + disabledSeconds: [], + hideDisabledOptions: false }; }, computed: { @@ -51,11 +55,11 @@ newVal = new Date(newVal); if (!isNaN(newVal)) { this.handleChange({ - hours: date.getHours(), - minutes: date.getMinutes(), - seconds: date.getSeconds() + hours: newVal.getHours(), + minutes: newVal.getMinutes(), + seconds: newVal.getSeconds() }); - this.$nextTick(_ => this.scrollTop()); + this.$nextTick(() => this.scrollTop()); } } }, diff --git a/src/components/date-picker/picker/time-picker.js b/src/components/date-picker/picker/time-picker.js index 0951052..4a35a68 100644 --- a/src/components/date-picker/picker/time-picker.js +++ b/src/components/date-picker/picker/time-picker.js @@ -1,32 +1,11 @@ import Picker from '../picker.vue'; import TimePanel from '../panel/time.vue'; +import Options from '../time-mixins'; export default { - mixins: [Picker], + mixins: [Picker, Options], props: { - value: {}, - disabledHours: { - type: Array, - default () { - return []; - } - }, - disabledMinutes: { - type: Array, - default () { - return []; - } - }, - disabledSeconds: { - type: Array, - default () { - return []; - } - }, - hideDisabledOptions: { - type: Boolean, - default: false - } + value: {} }, data () { return { diff --git a/src/components/date-picker/time-mixins.js b/src/components/date-picker/time-mixins.js new file mode 100644 index 0000000..63a3efa --- /dev/null +++ b/src/components/date-picker/time-mixins.js @@ -0,0 +1,26 @@ +export default { + props: { + disabledHours: { + type: Array, + default () { + return []; + } + }, + disabledMinutes: { + type: Array, + default () { + return []; + } + }, + disabledSeconds: { + type: Array, + default () { + return []; + } + }, + hideDisabledOptions: { + type: Boolean, + default: false + } + } +}; \ No newline at end of file -- libgit2 0.21.4