修复快速操作,数据没有提交的问题

This commit is contained in:
liaoxuezhi 2019-12-18 21:41:31 +08:00
parent f20a4c0190
commit eb466d6bff
1 changed files with 6 additions and 0 deletions

View File

@ -48,6 +48,7 @@ export default class FormControl extends React.PureComponent<
control: any;
hook?: () => any;
hook2?: () => any;
hook3?: () => any;
reaction?: () => void;
static defaultProps = {};
@ -144,6 +145,10 @@ export default class FormControl extends React.PureComponent<
}
}
// 提交前先把之前的 lazyEmit 执行一下。
this.hook3 = () => this.lazyEmitChange.flush();
addHook(this.hook3);
const formItem = this.model as IFormItemStore;
if (formItem && validate) {
let finalValidate = promisify(validate.bind(formItem));
@ -266,6 +271,7 @@ export default class FormControl extends React.PureComponent<
componentWillUnmount() {
this.hook && this.props.removeHook(this.hook);
this.hook2 && this.props.removeHook(this.hook2);
this.hook3 && this.props.removeHook(this.hook3);
this.lazyValidate.cancel();
// this.lazyEmitChange.flush();
this.lazyEmitChange.cancel();