From 29a91fbb6133a937866e81e7b552ee079002a99c Mon Sep 17 00:00:00 2001 From: Sergio Crisostomo Date: Mon, 5 Feb 2018 10:01:19 +0100 Subject: [PATCH] Correct passing of `confirm` prop, correct initial values when no value is passed --- src/components/date-picker/base/time-spinner.vue | 6 +++--- src/components/date-picker/panel/Date/date-panel-mixin.js | 4 ---- src/components/date-picker/panel/Time/time-range.vue | 15 +++++++-------- src/components/date-picker/panel/Time/time.vue | 9 ++++----- src/components/date-picker/panel/panel-mixin.js | 6 ++++++ 5 files changed, 20 insertions(+), 20 deletions(-) diff --git a/src/components/date-picker/base/time-spinner.vue b/src/components/date-picker/base/time-spinner.vue index 86d1296..e4a163c 100644 --- a/src/components/date-picker/base/time-spinner.vue +++ b/src/components/date-picker/base/time-spinner.vue @@ -28,15 +28,15 @@ props: { hours: { type: [Number, String], - default: 0 + default: NaN }, minutes: { type: [Number, String], - default: 0 + default: NaN }, seconds: { type: [Number, String], - default: 0 + default: NaN }, showSeconds: { type: Boolean, diff --git a/src/components/date-picker/panel/Date/date-panel-mixin.js b/src/components/date-picker/panel/Date/date-panel-mixin.js index 08bc10d..892ce89 100644 --- a/src/components/date-picker/panel/Date/date-panel-mixin.js +++ b/src/components/date-picker/panel/Date/date-panel-mixin.js @@ -5,10 +5,6 @@ import {initTimeDate } from '../../util'; export default { props: { - confirm: { - type: Boolean, - default: false - }, showTime: { type: Boolean, default: false diff --git a/src/components/date-picker/panel/Time/time-range.vue b/src/components/date-picker/panel/Time/time-range.vue index bbbbf71..3eed7f5 100644 --- a/src/components/date-picker/panel/Time/time-range.vue +++ b/src/components/date-picker/panel/Time/time-range.vue @@ -10,9 +10,9 @@ ref="timeSpinner" :steps="steps" :show-seconds="showSeconds" - :hours="dateStart.getHours()" - :minutes="dateStart.getMinutes()" - :seconds="dateStart.getSeconds()" + :hours="value[0] && dateStart.getHours()" + :minutes="value[0] && dateStart.getMinutes()" + :seconds="value[0] && dateStart.getSeconds()" :disabled-hours="disabledHours" :disabled-minutes="disabledMinutes" :disabled-seconds="disabledSeconds" @@ -29,9 +29,9 @@ ref="timeSpinnerEnd" :steps="steps" :show-seconds="showSeconds" - :hours="dateEnd.getHours()" - :minutes="dateEnd.getMinutes()" - :seconds="dateEnd.getSeconds()" + :hours="value[1] && dateEnd.getHours()" + :minutes="value[1] && dateEnd.getMinutes()" + :seconds="value[1] && dateEnd.getSeconds()" :disabled-hours="disabledHours" :disabled-minutes="disabledMinutes" :disabled-seconds="disabledSeconds" @@ -87,8 +87,7 @@ timePrefixCls: timePrefixCls, showDate: false, dateStart: dateStart || initTimeDate(), - dateEnd: dateEnd || initTimeDate(), - confirm: false + dateEnd: dateEnd || initTimeDate() }; }, computed: { diff --git a/src/components/date-picker/panel/Time/time.vue b/src/components/date-picker/panel/Time/time.vue index 0ae5046..0687678 100644 --- a/src/components/date-picker/panel/Time/time.vue +++ b/src/components/date-picker/panel/Time/time.vue @@ -7,9 +7,9 @@ ref="timeSpinner" :show-seconds="showSeconds" :steps="steps" - :hours="date.getHours()" - :minutes="date.getMinutes()" - :seconds="date.getSeconds()" + :hours="value[0] && date.getHours()" + :minutes="value[0] && date.getMinutes()" + :seconds="value[0] && date.getSeconds()" :disabled-hours="disabledHours" :disabled-minutes="disabledMinutes" :disabled-seconds="disabledSeconds" @@ -63,8 +63,7 @@ prefixCls: prefixCls, timePrefixCls: timePrefixCls, date: this.value[0] || initTimeDate(), - showDate: false, - confirm: false + showDate: false }; }, computed: { diff --git a/src/components/date-picker/panel/panel-mixin.js b/src/components/date-picker/panel/panel-mixin.js index 4ce733a..1cf5036 100644 --- a/src/components/date-picker/panel/panel-mixin.js +++ b/src/components/date-picker/panel/panel-mixin.js @@ -2,6 +2,12 @@ const prefixCls = 'ivu-picker-panel'; const datePrefixCls = 'ivu-date-picker'; export default { + props: { + confirm: { + type: Boolean, + default: false + } + }, methods: { iconBtnCls (direction, type = '') { return [ -- libgit2 0.21.4