fix: 修复persistData失效问题 (#2220)

This commit is contained in:
RickCole 2021-07-05 16:25:20 +08:00 committed by GitHub
parent b4092df595
commit 18eb69de0d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 6 deletions

View File

@ -448,7 +448,6 @@ export default class Form extends React.Component<FormProps, object> {
store.setCanAccessSuperData(canAccessSuperData !== false);
store.setPersistData(persistData);
persistData && store.getLocalPersistData();
if (simpleMode) {
store.setInited(true);
@ -622,7 +621,7 @@ export default class Form extends React.Component<FormProps, object> {
}
async onInit() {
const {onInit, store, submitOnInit} = this.props;
const {onInit, store, persistData, submitOnInit} = this.props;
if (!isAlive(store)) {
return;
}
@ -652,6 +651,8 @@ export default class Form extends React.Component<FormProps, object> {
};
}
persistData && store.getLocalPersistData();
onInit && onInit(data, this.props);
submitOnInit &&
@ -835,6 +836,10 @@ export default class Form extends React.Component<FormProps, object> {
submit
);
}
if (store.persistData) {
store.setLocalPersistData();
}
}
emitChange(submit: boolean) {

View File

@ -206,10 +206,6 @@ export const FormStore = ServiceStore.named('FormStore')
self.data = data;
if (self.persistData) {
setLocalPersistData();
}
// 同步 options
syncOptions();
}