Skip to content

Commit

Permalink
feat(core): useField return function that validateField
Browse files Browse the repository at this point in the history
  • Loading branch information
Mini-ghost committed Oct 1, 2023
1 parent 8d7aecb commit 0e87c0f
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 0 deletions.
1 change: 1 addition & 0 deletions packages/core/src/composables/useForm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -601,6 +601,7 @@ export function useForm<
value: getFieldValue(name),
attrs: getFieldAttrs(name),
...getFieldMeta(name),
validateField: () => validateField(toValue(name)),
};
};

Expand Down
1 change: 1 addition & 0 deletions packages/core/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ export interface FieldRegisterOptions<Values> {
export type UseFormRegisterReturn<Value> = FieldMeta<Value> & {
value: WritableComputedRef<Value>;
attrs: ComputedRef<FieldAttrs>;
validateField(): Promise<void>;
};

export type SetFieldArrayValue<Values extends FormValues> = <
Expand Down

0 comments on commit 0e87c0f

Please sign in to comment.