From a63a10c047cda32d92f35780163772fb20a6fe7a Mon Sep 17 00:00:00 2001 From: invalid w Date: Wed, 27 Sep 2023 16:38:59 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8Drule=20validator?= =?UTF-8?q?=E7=B1=BB=E5=9E=8B=E9=BB=98=E8=AE=A4=E4=B8=BAstring=EF=BC=8C?= =?UTF-8?q?=E5=AF=BC=E8=87=B4=20radio=20=E7=AD=89=E7=BB=84=E4=BB=B6?= =?UTF-8?q?=E5=9C=A8=20setFormValues=20=E6=97=B6=EF=BC=8C=E5=A6=82?= =?UTF-8?q?=E6=9E=9C=E5=80=BC=E4=B8=8D=E6=98=AFstring=E7=B1=BB=E5=9E=8B?= =?UTF-8?q?=EF=BC=8C=E6=8F=90=E7=A4=BA=E6=A0=A1=E9=AA=8C=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/Form/src/components/FormItem.vue | 4 ---- src/components/Form/src/helper.ts | 3 +++ 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/src/components/Form/src/components/FormItem.vue b/src/components/Form/src/components/FormItem.vue index 048037133..28ad32bd4 100644 --- a/src/components/Form/src/components/FormItem.vue +++ b/src/components/Form/src/components/FormItem.vue @@ -220,10 +220,6 @@ rule.required = false; } if (component) { - if (!Reflect.has(rule, 'type')) { - rule.type = component === 'InputNumber' ? 'number' : 'string'; - } - rule.message = rule.message || defaultMsg; if (component.includes('Input') || component.includes('Textarea')) { diff --git a/src/components/Form/src/helper.ts b/src/components/Form/src/helper.ts index 7c5d0b1f3..e37f5e9ef 100644 --- a/src/components/Form/src/helper.ts +++ b/src/components/Form/src/helper.ts @@ -40,6 +40,9 @@ export function setComponentRuleType( component: ComponentType, valueFormat: string, ) { + if (Reflect.has(rule, 'type')) { + return; + } if (['DatePicker', 'MonthPicker', 'WeekPicker', 'TimePicker'].includes(component)) { rule.type = valueFormat ? 'string' : 'object'; } else if (['RangePicker', 'Upload', 'CheckboxGroup', 'TimePicker'].includes(component)) {