Browse Source
Merge pull request #3082 from wangjue666/fix-form-rule-validate
fix: 修复rule validator type默认为string
pull/3087/head
invalid w
3 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with
3 additions and
4 deletions
-
src/components/Form/src/components/FormItem.vue
-
src/components/Form/src/helper.ts
|
|
|
@ -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')) { |
|
|
|
|
|
|
|
@ -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)) { |
|
|
|
|