From c8d9d263c3d9572951a21fa5ea62f29e17e68fe4 Mon Sep 17 00:00:00 2001 From: xuqingkai Date: Fri, 29 Mar 2024 13:09:25 +0800 Subject: [PATCH] =?UTF-8?q?refactor:=20=E2=99=BB=EF=B8=8F=20=20=E4=BD=BF?= =?UTF-8?q?=E7=94=A8isFunction=E7=AD=89=E5=B7=A5=E5=85=B7=E6=96=B9?= =?UTF-8?q?=E6=B3=95=E6=9B=BF=E6=8D=A2getType?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../wot-design-uni/components/common/dayjs.ts | 4 +++- .../wot-design-uni/components/common/util.ts | 2 +- .../components/wd-action-sheet/wd-action-sheet.vue | 9 +++++---- .../components/wd-calendar-view/month/month.vue | 4 ++-- .../components/wd-calendar-view/utils.ts | 6 +++--- .../components/wd-calendar-view/year/year.vue | 4 ++-- .../wd-calendar-view/yearPanel/year-panel.vue | 5 ++--- .../components/wd-calendar/wd-calendar.vue | 2 +- .../components/wd-col-picker/wd-col-picker.vue | 12 ++++++------ .../components/wd-input-number/wd-input-number.vue | 10 +++------- .../components/wd-switch/wd-switch.vue | 4 ++-- .../wot-design-uni/components/wd-tab/types.ts | 4 ++-- .../wot-design-uni/components/wd-tab/wd-tab.vue | 4 ++-- .../wot-design-uni/components/wd-tabs/wd-tabs.vue | 8 ++++---- .../components/wd-upload/wd-upload.vue | 14 +++++++------- 15 files changed, 45 insertions(+), 47 deletions(-) diff --git a/src/uni_modules/wot-design-uni/components/common/dayjs.ts b/src/uni_modules/wot-design-uni/components/common/dayjs.ts index 7252c018..bc3277ad 100644 --- a/src/uni_modules/wot-design-uni/components/common/dayjs.ts +++ b/src/uni_modules/wot-design-uni/components/common/dayjs.ts @@ -1,3 +1,5 @@ +import { isDate } from './util' + /* eslint-disable */ class Dayjs { utc: boolean @@ -28,7 +30,7 @@ class Dayjs { parseConfig(dateStr?:string | number | Date) { if (!dateStr) return new Date() - if (dateStr instanceof Date) return dateStr + if (isDate(dateStr)) return dateStr if (/^(\d){8}$/.test(dateStr as string)) { this.utc = true return `${(dateStr as string).substr(0, 4)}-${(dateStr as string).substr(4, 2)}-${(dateStr as string).substr(6, 2)}` diff --git a/src/uni_modules/wot-design-uni/components/common/util.ts b/src/uni_modules/wot-design-uni/components/common/util.ts index 55c336d4..8feace3b 100644 --- a/src/uni_modules/wot-design-uni/components/common/util.ts +++ b/src/uni_modules/wot-design-uni/components/common/util.ts @@ -439,7 +439,7 @@ export function deepClone(obj: T, cache: Map = new Map()): T { } // 处理特殊对象类型:日期、正则表达式、错误对象 - if (obj instanceof Date) { + if (isDate(obj)) { return new Date(obj.getTime()) as any } if (obj instanceof RegExp) { diff --git a/src/uni_modules/wot-design-uni/components/wd-action-sheet/wd-action-sheet.vue b/src/uni_modules/wot-design-uni/components/wd-action-sheet/wd-action-sheet.vue index 0164c34b..ef4268ac 100644 --- a/src/uni_modules/wot-design-uni/components/wd-action-sheet/wd-action-sheet.vue +++ b/src/uni_modules/wot-design-uni/components/wd-action-sheet/wd-action-sheet.vue @@ -73,6 +73,7 @@ export default {