From 46d6d435dc44376e7d42629a45a382063126e0dc Mon Sep 17 00:00:00 2001 From: soon Date: Tue, 29 Aug 2017 18:35:45 +0800 Subject: [PATCH 1/2] =?UTF-8?q?datepicker=E6=B7=BB=E5=8A=A0=E7=A1=AE?= =?UTF-8?q?=E5=AE=9A=E6=8C=89=E9=92=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/js/components/form/KLDatePicker/Calendar/index.js | 5 ++--- src/js/components/form/KLDatePicker/index.html | 3 +++ src/js/components/form/KLDatePicker/index.js | 10 ++++++---- src/js/components/form/KLDatePicker/index.mcss | 10 ++++++++++ 4 files changed, 21 insertions(+), 7 deletions(-) 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 From ccadbb58762f384c0dee22ab429b81c24f6f49bf Mon Sep 17 00:00:00 2001 From: soon Date: Tue, 29 Aug 2017 19:27:15 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E4=BC=A0=E5=85=A5=E7=82=B9=E5=87=BB?= =?UTF-8?q?=E4=BA=8B=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/js/components/form/KLDatePicker/Calendar/index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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