fix(form): ensure that the Form component does not verify hidden form items
This commit is contained in:
parent
e0dc5cf2f2
commit
43a45b7c99
|
|
@ -4,6 +4,7 @@
|
||||||
|
|
||||||
- `BasicTree` 新增`clickRowToExpand`,用于单击树节点展开
|
- `BasicTree` 新增`clickRowToExpand`,用于单击树节点展开
|
||||||
- 新增 SvgIcon 插件及示例
|
- 新增 SvgIcon 插件及示例
|
||||||
|
- 账号管理界面增加左侧部门树
|
||||||
|
|
||||||
### ⚡ Performance Improvements
|
### ⚡ Performance Improvements
|
||||||
|
|
||||||
|
|
@ -22,6 +23,7 @@
|
||||||
- 修复账号管理新增未清空旧数据
|
- 修复账号管理新增未清空旧数据
|
||||||
- form 组件应允许 setFieldsValue 方法值为 null 或者 undefined
|
- form 组件应允许 setFieldsValue 方法值为 null 或者 undefined
|
||||||
- 确保单级面包屑正确跳转
|
- 确保单级面包屑正确跳转
|
||||||
|
- 确保 Form 组件不校验隐藏的表单项
|
||||||
|
|
||||||
## 2.0.2 (2021-03-04)
|
## 2.0.2 (2021-03-04)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -97,7 +97,7 @@ export default defineComponent({
|
||||||
return disabled;
|
return disabled;
|
||||||
});
|
});
|
||||||
|
|
||||||
function getShow() {
|
function getShow(): { isShow: boolean; isIfShow: boolean } {
|
||||||
const { show, ifShow } = props.schema;
|
const { show, ifShow } = props.schema;
|
||||||
const { showAdvancedButton } = props.formProps;
|
const { showAdvancedButton } = props.formProps;
|
||||||
const itemIsAdvanced = showAdvancedButton
|
const itemIsAdvanced = showAdvancedButton
|
||||||
|
|
@ -151,6 +151,10 @@ export default defineComponent({
|
||||||
const { rulesMessageJoinLabel: globalRulesMessageJoinLabel } = props.formProps;
|
const { rulesMessageJoinLabel: globalRulesMessageJoinLabel } = props.formProps;
|
||||||
if (requiredRuleIndex !== -1) {
|
if (requiredRuleIndex !== -1) {
|
||||||
const rule = rules[requiredRuleIndex];
|
const rule = rules[requiredRuleIndex];
|
||||||
|
const { isShow } = getShow();
|
||||||
|
if (!isShow) {
|
||||||
|
rule.required = false;
|
||||||
|
}
|
||||||
if (rule.required && component) {
|
if (rule.required && component) {
|
||||||
if (!Reflect.has(rule, 'type')) {
|
if (!Reflect.has(rule, 'type')) {
|
||||||
rule.type = 'string';
|
rule.type = 'string';
|
||||||
|
|
|
||||||
|
|
@ -183,6 +183,7 @@ export function useFormEvents({
|
||||||
async function validateFields(nameList?: NamePath[] | undefined) {
|
async function validateFields(nameList?: NamePath[] | undefined) {
|
||||||
return unref(formElRef)?.validateFields(nameList);
|
return unref(formElRef)?.validateFields(nameList);
|
||||||
}
|
}
|
||||||
|
|
||||||
async function validate(nameList?: NamePath[] | undefined) {
|
async function validate(nameList?: NamePath[] | undefined) {
|
||||||
return await unref(formElRef)?.validate(nameList);
|
return await unref(formElRef)?.validate(nameList);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -61,7 +61,7 @@ export const accountFormSchema: FormSchema[] = [
|
||||||
label: '密码',
|
label: '密码',
|
||||||
component: 'InputPassword',
|
component: 'InputPassword',
|
||||||
required: true,
|
required: true,
|
||||||
show: true,
|
show: false,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: '角色',
|
label: '角色',
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue