chore: 优化select等组件的默认校验规则
This commit is contained in:
parent
b753481ac1
commit
d2b512ff91
@ -32,6 +32,7 @@ import {
|
|||||||
TreeSelect,
|
TreeSelect,
|
||||||
Upload,
|
Upload,
|
||||||
} from 'ant-design-vue';
|
} from 'ant-design-vue';
|
||||||
|
import { isArray } from 'lodash-es';
|
||||||
|
|
||||||
// 业务表单组件适配
|
// 业务表单组件适配
|
||||||
|
|
||||||
@ -107,7 +108,10 @@ setupVbenForm<FormComponentType>({
|
|||||||
return true;
|
return true;
|
||||||
},
|
},
|
||||||
selectRequired: (value, _params, ctx) => {
|
selectRequired: (value, _params, ctx) => {
|
||||||
if (value === undefined || value === null) {
|
if (
|
||||||
|
[false, null, undefined].includes(value) ||
|
||||||
|
(isArray(value) && value.length === 0)
|
||||||
|
) {
|
||||||
return $t('formRules.selectRequired', [ctx.label]);
|
return $t('formRules.selectRequired', [ctx.label]);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
Loading…
Reference in New Issue
Block a user