mirror of
https://github.com/vbenjs/vue-vben-admin.git
synced 2025-01-24 10:33:50 +08:00
chore: 自定义组件默认rule校验默认触发逻辑为blur
This commit is contained in:
parent
1296590e3a
commit
23b684977c
@ -169,7 +169,6 @@
|
||||
dynamicRules,
|
||||
required,
|
||||
} = props.schema;
|
||||
|
||||
if (isFunction(dynamicRules)) {
|
||||
return dynamicRules(unref(getValues)) as ValidationRule[];
|
||||
}
|
||||
@ -210,7 +209,6 @@
|
||||
}
|
||||
return Promise.resolve();
|
||||
}
|
||||
|
||||
const getRequired = isFunction(required) ? required(unref(getValues)) : required;
|
||||
|
||||
/*
|
||||
@ -220,7 +218,10 @@
|
||||
*/
|
||||
if (getRequired) {
|
||||
if (!rules || rules.length === 0) {
|
||||
rules = [{ required: getRequired, validator }];
|
||||
const trigger = NO_AUTO_LINK_COMPONENTS.includes(component || 'Input')
|
||||
? 'blur'
|
||||
: 'change';
|
||||
rules = [{ required: getRequired, validator, trigger }];
|
||||
} else {
|
||||
const requiredIndex: number = rules.findIndex((rule) => Reflect.has(rule, 'required'));
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user