diff --git a/src/js/components/form/KLDatePicker/Calendar/index.html b/src/js/components/form/KLDatePicker/Calendar/index.html index cba1db09..23101f4d 100644 --- a/src/js/components/form/KLDatePicker/Calendar/index.html +++ b/src/js/components/form/KLDatePicker/Calendar/index.html @@ -12,7 +12,7 @@
{this.$trans('CAL_SUNDAY')}{this.$trans('CAL_MONDAY')}{this.$trans('CAL_TUESDAY')}{this.$trans('CAL_WENSDAY')}{this.$trans('CAL_THURSDAY')}{this.$trans('CAL_FRIDAY')}{this.$trans('CAL_SATURDAY')}
-
{#list _days as day}{day | format: 'dd'}{/list}
+
{#list _days as day}{day | format: 'dd'}{/list}
{#inc this.$body}
\ No newline at end of file diff --git a/src/js/components/form/KLDatePicker/Calendar/index.js b/src/js/components/form/KLDatePicker/Calendar/index.js index d63e9c0a..8edab279 100644 --- a/src/js/components/form/KLDatePicker/Calendar/index.js +++ b/src/js/components/form/KLDatePicker/Calendar/index.js @@ -146,7 +146,6 @@ const Calendar = Component.extend({ */ _update() { this.data._days = []; - const date = this.data.date; const month = date.getMonth(); const mfirst = new Date(date); @@ -210,11 +209,11 @@ const Calendar = Component.extend({ * @param {Date} date 选择的日期 * @return {void} */ - select(date) { + select(date, e) { + e.stopPropagation(); if (this.data.readonly || this.data.disabled || this.isOutOfRange(date)) { return; } - this.data.date = new Date(date); /** diff --git a/src/js/components/form/KLDatePicker/index.html b/src/js/components/form/KLDatePicker/index.html index 1849fd62..93daba63 100644 --- a/src/js/components/form/KLDatePicker/index.html +++ b/src/js/components/form/KLDatePicker/index.html @@ -18,6 +18,9 @@ {#if showTime} {/if} + diff --git a/src/js/components/form/KLDatePicker/index.js b/src/js/components/form/KLDatePicker/index.js index 00b4802b..c28f13c6 100644 --- a/src/js/components/form/KLDatePicker/index.js +++ b/src/js/components/form/KLDatePicker/index.js @@ -161,15 +161,18 @@ const KLDatePicker = Dropdown.extend({ return; } this._onDateTimeChange(date, time); - + }, + onConfirm() { + if (this.data.readonly || this.data.disabled || this.isOutOfRange(this.date)) { + return; + } this._onOk(); - - // this.toggle(false); }, _onClose() { this.toggle(false); }, _onOk() { + this.date || this._onDateTimeChange(this.data._date); this.data.date = this.date; this.data.time = this.time; /** @@ -196,7 +199,6 @@ const KLDatePicker = Dropdown.extend({ _onInput($event) { const value = $event.target.value; const date = value ? new Date(value) : null; - if (date !== 'Invalid Date') this.data.date = date; else { $event.target.value = filter.format( diff --git a/src/js/components/form/KLDatePicker/index.mcss b/src/js/components/form/KLDatePicker/index.mcss index cfae729a..d0409c8b 100644 --- a/src/js/components/form/KLDatePicker/index.mcss +++ b/src/js/components/form/KLDatePicker/index.mcss @@ -16,4 +16,14 @@ .btns { margin-top: 10px; } + .dropdown_ft { + display: flex; + padding: 4px 0 0; + margin-top: 4px; + justify-content: flex-end; + border-top: 1px solid #ddd; + a { + color: #333; + } + } } \ No newline at end of file