File tree Expand file tree Collapse file tree 3 files changed +17
-4
lines changed Expand file tree Collapse file tree 3 files changed +17
-4
lines changed Original file line number Diff line number Diff line change @@ -22,6 +22,7 @@ import type {
2222 RuleError ,
2323 ValidateErrorEntity ,
2424 ValidateOptions ,
25+ Callbacks ,
2526} from './interface' ;
2627import { useInjectSize } from '../_util/hooks/useSize' ;
2728import useConfigInject from '../_util/hooks/useConfigInject' ;
@@ -76,11 +77,13 @@ export const formProps = {
7677 // 提交失败自动滚动到第一个错误字段
7778 scrollToFirstError : { type : [ Boolean , Object ] as PropType < boolean | Options > } ,
7879 onSubmit : PropTypes . func ,
79- onFinish : PropTypes . func ,
80- onFinishFailed : PropTypes . func ,
8180 name : PropTypes . string ,
8281 validateTrigger : { type : [ String , Array ] as PropType < string | string [ ] > } ,
8382 size : { type : String as PropType < SizeType > } ,
83+ onValuesChange : { type : Function as PropType < Callbacks [ 'onValuesChange' ] > } ,
84+ onFieldsChange : { type : Function as PropType < Callbacks [ 'onFieldsChange' ] > } ,
85+ onFinish : { type : Function as PropType < Callbacks [ 'onFinish' ] > } ,
86+ onFinishFailed : { type : Function as PropType < Callbacks [ 'onFinishFailed' ] > } ,
8487} ;
8588
8689export type FormProps = Partial < ExtractPropTypes < typeof formProps > > ;
Original file line number Diff line number Diff line change @@ -274,8 +274,16 @@ export default defineComponent({
274274
275275 useProvideFormItemContext ( {
276276 id : fieldId ,
277- onFieldBlur,
278- onFieldChange,
277+ onFieldBlur : ( ) => {
278+ if ( props . autoLink ) {
279+ onFieldBlur ( ) ;
280+ }
281+ } ,
282+ onFieldChange : ( ) => {
283+ if ( props . autoLink ) {
284+ onFieldChange ( ) ;
285+ }
286+ } ,
279287 clearValidate,
280288 } ) ;
281289 let registered = false ;
Original file line number Diff line number Diff line change @@ -3,10 +3,12 @@ import Form, { formProps } from './Form';
33import FormItem , { formItemProps } from './FormItem' ;
44import useForm from './useForm' ;
55import { useInjectFormItemContext } from './FormItemContext' ;
6+ export type { Rule , RuleObject } from './interface' ;
67
78export type { FormProps } from './Form' ;
89export type { FormItemProps } from './FormItem' ;
910
11+ Form . useInjectFormItemContext = useInjectFormItemContext ;
1012/* istanbul ignore next */
1113Form . install = function ( app : App ) {
1214 app . component ( Form . name , Form ) ;
You can’t perform that action at this time.
0 commit comments