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)) {