Skip to content

Commit

Permalink
fix: item error when not use in form, close #5343
Browse files Browse the repository at this point in the history
  • Loading branch information
tangjinzhou committed Mar 16, 2022
1 parent 1e8bbcc commit 4471520
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion components/form/context.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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 */
Expand Down

0 comments on commit 4471520

Please sign in to comment.