diff --git a/components/form/Form.tsx b/components/form/Form.tsx index d173c97cc..4f058213f 100755 --- a/components/form/Form.tsx +++ b/components/form/Form.tsx @@ -22,6 +22,7 @@ import type { RuleError, ValidateErrorEntity, ValidateOptions, + Callbacks, } from './interface'; import { useInjectSize } from '../_util/hooks/useSize'; import useConfigInject from '../_util/hooks/useConfigInject'; @@ -76,11 +77,13 @@ export const formProps = { // 提交失败自动滚动到第一个错误字段 scrollToFirstError: { type: [Boolean, Object] as PropType }, onSubmit: PropTypes.func, - onFinish: PropTypes.func, - onFinishFailed: PropTypes.func, name: PropTypes.string, validateTrigger: { type: [String, Array] as PropType }, size: { type: String as PropType }, + onValuesChange: { type: Function as PropType }, + onFieldsChange: { type: Function as PropType }, + onFinish: { type: Function as PropType }, + onFinishFailed: { type: Function as PropType }, }; export type FormProps = Partial>; diff --git a/components/form/FormItem.tsx b/components/form/FormItem.tsx index a1b7164c9..e8060fa2e 100644 --- a/components/form/FormItem.tsx +++ b/components/form/FormItem.tsx @@ -274,8 +274,16 @@ export default defineComponent({ useProvideFormItemContext({ id: fieldId, - onFieldBlur, - onFieldChange, + onFieldBlur: () => { + if (props.autoLink) { + onFieldBlur(); + } + }, + onFieldChange: () => { + if (props.autoLink) { + onFieldChange(); + } + }, clearValidate, }); let registered = false; diff --git a/components/form/index.tsx b/components/form/index.tsx index 56062202e..7077152d0 100644 --- a/components/form/index.tsx +++ b/components/form/index.tsx @@ -3,10 +3,12 @@ import Form, { formProps } from './Form'; import FormItem, { formItemProps } from './FormItem'; import useForm from './useForm'; import { useInjectFormItemContext } from './FormItemContext'; +export type { Rule, RuleObject } from './interface'; export type { FormProps } from './Form'; export type { FormItemProps } from './FormItem'; +Form.useInjectFormItemContext = useInjectFormItemContext; /* istanbul ignore next */ Form.install = function (app: App) { app.component(Form.name, Form);