mirror of
https://github.com/vbenjs/vue-vben-admin.git
synced 2025-01-24 10:33:50 +08:00
fix: 修复rule validator类型默认为string,导致 radio 等组件在 setFormValues 时,如果值不是string类型,提示校验错误
This commit is contained in:
parent
b46a505582
commit
a63a10c047
@ -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)) {
|
||||
|
Loading…
Reference in New Issue
Block a user