From f134d0468580797c184753ce17d9085a71e96516 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B0=B1=E7=9C=A0=E5=84=80=E5=BC=8F?= <854085467@qq.com> Date: Mon, 18 Jul 2022 09:15:26 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=93=9D(select):=20update?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../datePicker/components/DateRange.vue | 44 ++++--- .../datePicker/components/MonthRange.vue | 114 ++++++++++++++---- .../src/component/datePicker/index.vue | 91 ++++++++++---- .../src/document/zh-CN/components/select.md | 4 +- 4 files changed, 182 insertions(+), 71 deletions(-) diff --git a/package/component/src/component/datePicker/components/DateRange.vue b/package/component/src/component/datePicker/components/DateRange.vue index 3de93e0a..32426d6f 100644 --- a/package/component/src/component/datePicker/components/DateRange.vue +++ b/package/component/src/component/datePicker/components/DateRange.vue @@ -279,16 +279,22 @@ const closeRightMonthPanel = () => { const footOnOk = () => { let format = datePicker.type === "datetime" ? "YYYY-MM-DD HH:mm:ss" : "YYYY-MM-DD"; - let startTimeVal =startTime.day!==-1&&endTime.day!==-1?dayjs(startTime.day) - .hour(startTime.hms.hh) - .minute(startTime.hms.mm) - .second(startTime.hms.ss) - .format(format):''; - let endTimeVal = startTime.day!==-1&&endTime.day!==-1?dayjs(endTime.day) - .hour(endTime.hms.hh) - .minute(endTime.hms.mm) - .second(endTime.hms.ss) - .format(format):''; + let startTimeVal = + startTime.day !== -1 && endTime.day !== -1 + ? dayjs(startTime.day) + .hour(startTime.hms.hh) + .minute(startTime.hms.mm) + .second(startTime.hms.ss) + .format(format) + : ""; + let endTimeVal = + startTime.day !== -1 && endTime.day !== -1 + ? dayjs(endTime.day) + .hour(endTime.hms.hh) + .minute(endTime.hms.mm) + .second(endTime.hms.ss) + .format(format) + : ""; emits("update:startTime", startTimeVal); emits("update:endTime", endTimeVal); datePicker.ok(); @@ -296,18 +302,18 @@ const footOnOk = () => { //现在回调 const footOnNow = () => { - startTime.year=dayjs().year(); - startTime.month=dayjs().month(); - startTime.day=new Date(new Date().toDateString()).getTime(); - startTime.hms.hh=dayjs().hour(); - startTime.hms.mm=dayjs().minute(); - startTime.hms.ss=dayjs().second(); - endTime.day=-1; + startTime.year = dayjs().year(); + startTime.month = dayjs().month(); + startTime.day = new Date(new Date().toDateString()).getTime(); + startTime.hms.hh = dayjs().hour(); + startTime.hms.mm = dayjs().minute(); + startTime.hms.ss = dayjs().second(); + endTime.day = -1; }; //清空回调 const footOnClear = () => { - startTime.day=-1; - endTime.day=-1; + startTime.day = -1; + endTime.day = -1; }; diff --git a/package/component/src/component/datePicker/components/MonthRange.vue b/package/component/src/component/datePicker/components/MonthRange.vue index 4f6dba78..6cee2c9a 100644 --- a/package/component/src/component/datePicker/components/MonthRange.vue +++ b/package/component/src/component/datePicker/components/MonthRange.vue @@ -3,21 +3,43 @@