From 781f7c9cd1722b72b8eea7be408a253472a8d6c6 Mon Sep 17 00:00:00 2001 From: xingyu Date: Tue, 10 Oct 2023 10:57:48 +0800 Subject: [PATCH] =?UTF-8?q?fix(component):=20fix:=20=E4=BF=AE=E5=A4=8Drule?= =?UTF-8?q?=20validator=E7=B1=BB=E5=9E=8B=E9=BB=98=E8=AE=A4=E4=B8=BAstring?= =?UTF-8?q?=EF=BC=8C=E5=AF=BC=E8=87=B4=20radio=20=E7=AD=89=E7=BB=84?= =?UTF-8?q?=E4=BB=B6=E5=9C=A8=20setFormValues=20=E6=97=B6=EF=BC=8C?= =?UTF-8?q?=E5=A6=82=E6=9E=9C=E5=80=BC=E4=B8=8D=E6=98=AFstring=E7=B1=BB?= =?UTF-8?q?=E5=9E=8B=EF=BC=8C=E6=8F=90=E7=A4=BA=E6=A0=A1=E9=AA=8C=E9=94=99?= =?UTF-8?q?=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 | 3 --- src/components/Form/src/helper.ts | 3 +++ 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/components/Form/src/components/FormItem.vue b/src/components/Form/src/components/FormItem.vue index 0ef96fd3..c165585f 100644 --- a/src/components/Form/src/components/FormItem.vue +++ b/src/components/Form/src/components/FormItem.vue @@ -200,9 +200,6 @@ export default defineComponent({ 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 604289d0..174ab298 100644 --- a/src/components/Form/src/helper.ts +++ b/src/components/Form/src/helper.ts @@ -36,6 +36,9 @@ function genType() { } export function setComponentRuleType(rule: Rule, 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))