diff --git a/src/renderers/Dialog.tsx b/src/renderers/Dialog.tsx index d1462af44..4f4854467 100644 --- a/src/renderers/Dialog.tsx +++ b/src/renderers/Dialog.tsx @@ -306,7 +306,10 @@ export default class Dialog extends React.Component { disabled: (body && (body as any).disabled) || store.loading, onAction: this.handleAction, onFinished: this.handleChildFinished, - affixOffsetTop: 0 + affixOffsetTop: 0, + onChange: this.handleFormChange, + onInit: this.handleFormInit, + onSaved: this.handleFormSaved }; if (!(body as Schema).type) { @@ -322,10 +325,6 @@ export default class Dialog extends React.Component { submitText: null, ...schema }; - - subProps.onChange = this.handleFormChange; - subProps.onInit = this.handleFormInit; - subProps.onSaved = this.handleFormSaved; } return render(`body${key ? `/${key}` : ''}`, schema, subProps); diff --git a/src/renderers/Drawer.tsx b/src/renderers/Drawer.tsx index fdf900fb7..95b1805b8 100644 --- a/src/renderers/Drawer.tsx +++ b/src/renderers/Drawer.tsx @@ -276,7 +276,10 @@ export default class Drawer extends React.Component { disabled: store.loading, onAction: this.handleAction, onFinished: this.handleChildFinished, - popOverContainer: this.getPopOverContainer + popOverContainer: this.getPopOverContainer, + onChange: this.handleFormChange, + onInit: this.handleFormInit, + onSaved: this.handleFormSaved }; if (schema.type === 'form') { @@ -286,11 +289,6 @@ export default class Drawer extends React.Component { submitText: null, ...schema }; - - // 同步数据到 Dialog 层,方便 actions 根据表单数据联动。 - subProps.onChange = this.handleFormChange; - subProps.onInit = this.handleFormInit; - subProps.onSaved = this.handleFormSaved; } return render(`body${key ? `/${key}` : ''}`, schema, subProps); diff --git a/src/renderers/Form/index.tsx b/src/renderers/Form/index.tsx index 37b1339c8..6a8343625 100644 --- a/src/renderers/Form/index.tsx +++ b/src/renderers/Form/index.tsx @@ -158,6 +158,7 @@ export default class Form extends React.Component { 'onChange', 'onFailed', 'onFinished', + 'onSaved', 'canAccessSuperData', 'lazyChange', 'formLazyChange',