Merge pull request #10766 from thinkingc/fix-form-lazyEmitChange

fix: Form组件的formLazyChange针对监听生效
This commit is contained in:
hsm-lv 2024-08-16 12:11:04 +08:00 committed by GitHub
commit 577413859d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -507,7 +507,8 @@ export default class Form extends React.Component<FormProps, object> {
this.beforePageUnload = this.beforePageUnload.bind(this); this.beforePageUnload = this.beforePageUnload.bind(this);
this.formItemDispatchEvent = this.formItemDispatchEvent.bind(this); this.formItemDispatchEvent = this.formItemDispatchEvent.bind(this);
const {store, canAccessSuperData, persistData, simpleMode} = props; const {store, canAccessSuperData, persistData, simpleMode, formLazyChange} =
props;
store.setCanAccessSuperData(canAccessSuperData !== false); store.setCanAccessSuperData(canAccessSuperData !== false);
store.setPersistData(persistData); store.setPersistData(persistData);
@ -538,7 +539,10 @@ export default class Form extends React.Component<FormProps, object> {
() => store.initedAt, () => store.initedAt,
() => { () => {
store.inited && store.inited &&
this.lazyEmitChange(!!this.props.submitOnChange, true); (formLazyChange === false ? this.emitChange : this.lazyEmitChange)(
!!this.props.submitOnChange,
true
);
} }
) )
); );