From cf706a9e5bf08088d6349809bb181bd3f926e5d1 Mon Sep 17 00:00:00 2001 From: TTTTian <15829010387@163.com> Date: Tue, 4 Jun 2024 10:05:13 +0000 Subject: [PATCH 1/2] =?UTF-8?q?fix:=20=E6=97=A5=E6=9C=9F=E7=BB=84=E4=BB=B6?= =?UTF-8?q?=EF=BC=9A=E5=B7=B2=E9=80=89=E4=B8=AD=E9=BB=98=E8=AE=A4=E5=80=BC?= =?UTF-8?q?=EF=BC=8C=E6=98=BE=E7=A4=BA=E7=B1=BB=E5=9E=8B=E5=9C=A8=E7=94=B1?= =?UTF-8?q?=20dates=20=E5=88=87=E6=8D=A2=20=E5=88=B0=E5=85=B6=E4=BB=96?= =?UTF-8?q?=E7=B1=BB=E5=9E=8B=EF=BC=8C=E6=88=96=E5=85=B6=E4=BB=96=E7=B1=BB?= =?UTF-8?q?=E5=9E=8B=E5=88=87=E6=8D=A2=E5=88=B0=20dates=20=E6=97=B6=20?= =?UTF-8?q?=E7=9A=84=E6=8A=A5=E9=94=99=E5=AF=BC=E8=87=B4=E6=95=B4=E4=B8=AA?= =?UTF-8?q?=E8=AE=BE=E8=AE=A1=E5=99=A8=E6=97=A0=E5=93=8D=E5=BA=94?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../form-widget/field-widget/date-widget.vue | 15 ++++++++++++++- .../field-date/date-defaultValue-editor.vue | 15 ++++++++++++++- 2 files changed, 28 insertions(+), 2 deletions(-) diff --git a/src/components/form-designer/form-widget/field-widget/date-widget.vue b/src/components/form-designer/form-widget/field-widget/date-widget.vue index 5452d82..0148f77 100644 --- a/src/components/form-designer/form-widget/field-widget/date-widget.vue +++ b/src/components/form-designer/form-widget/field-widget/date-widget.vue @@ -2,7 +2,7 @@ - - @@ -18,6 +18,19 @@ selectedWidget: Object, optionModel: Object, }, + watch: { + 'optionModel.type': { + deep: true, + handler(val, oldVal){ + if (val === 'dates' && oldVal !== 'dates'){ + this.optionModel.defaultValue = [this.optionModel.defaultValue] + } + if (val !== 'dates' && oldVal === 'dates'){ + this.optionModel.defaultValue = this.optionModel.defaultValue[0] + } + }, + } + }, } From 0176ea21af26e48d5621e979646d908e47a3981b Mon Sep 17 00:00:00 2001 From: TTTTian <15829010387@163.com> Date: Wed, 5 Jun 2024 03:22:58 +0000 Subject: [PATCH 2/2] =?UTF-8?q?dates=20=E6=97=B6=20=E6=B8=85=E7=A9=BA?= =?UTF-8?q?=E9=BB=98=E8=AE=A4=E5=80=BC=20=E5=88=87=E6=8D=A2=E6=98=BE?= =?UTF-8?q?=E7=A4=BA=E7=B1=BB=E5=9E=8B=E6=8A=A5=E9=94=99=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../form-designer/form-widget/field-widget/date-widget.vue | 2 +- .../property-editor/field-date/date-defaultValue-editor.vue | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/form-designer/form-widget/field-widget/date-widget.vue b/src/components/form-designer/form-widget/field-widget/date-widget.vue index 0148f77..bb2a79d 100644 --- a/src/components/form-designer/form-widget/field-widget/date-widget.vue +++ b/src/components/form-designer/form-widget/field-widget/date-widget.vue @@ -72,7 +72,7 @@ this.fieldModel = [this.fieldModel] } if (val !== 'dates' && oldVal === 'dates'){ - this.fieldModel = this.fieldModel[0] + this.fieldModel = this.fieldModel ? this.fieldModel[0] : null } }, } diff --git a/src/components/form-designer/setting-panel/property-editor/field-date/date-defaultValue-editor.vue b/src/components/form-designer/setting-panel/property-editor/field-date/date-defaultValue-editor.vue index b577e0c..d13ffe3 100644 --- a/src/components/form-designer/setting-panel/property-editor/field-date/date-defaultValue-editor.vue +++ b/src/components/form-designer/setting-panel/property-editor/field-date/date-defaultValue-editor.vue @@ -26,7 +26,7 @@ this.optionModel.defaultValue = [this.optionModel.defaultValue] } if (val !== 'dates' && oldVal === 'dates'){ - this.optionModel.defaultValue = this.optionModel.defaultValue[0] + this.optionModel.defaultValue = this.optionModel.defaultValue ? this.optionModel.defaultValue[0] : null } }, }