fix: item error when not use in form, close #5343

pull/5350/head
tangjinzhou 2022-03-16 20:39:25 +08:00
parent 1e8bbccdd2
commit 4471520e35
1 changed files with 6 additions and 1 deletions

View File

@ -37,6 +37,7 @@ export const useProvideForm = (state: FormContextProps) => {
export const useInjectForm = () => {
return inject(FormContextKey, {
name: computed(() => undefined),
labelAlign: computed(() => 'right' as FormLabelAlign),
vertical: computed(() => false),
// eslint-disable-next-line @typescript-eslint/no-unused-vars
@ -45,10 +46,14 @@ export const useInjectForm = () => {
removeField: (_eventKey: string) => {},
model: computed(() => undefined),
rules: computed(() => undefined),
colon: computed(() => undefined),
labelWrap: computed(() => undefined),
labelCol: computed(() => undefined),
requiredMark: computed(() => false),
validateTrigger: computed(() => undefined),
onValidate: () => {},
validateMessages: computed(() => defaultValidateMessages),
});
} as FormContextProps);
};
/** Used for ErrorList only */