mirror of
https://gitee.com/baidu/amis.git
synced 2024-11-30 02:58:05 +08:00
fix(amis-editor): 编辑器ScaffoldModal切换步骤Form数据丢失问题
This commit is contained in:
parent
389b73c5be
commit
309f63c0b8
@ -138,6 +138,8 @@ export class ScaffoldModal extends React.Component<SubEditorProps> {
|
||||
const form = this.amisScope?.getComponents()[0].props.store;
|
||||
const step = store.scaffoldFormStep + 1;
|
||||
form.setValueByName('__step', step);
|
||||
/** 切换步骤导致schema重新渲染,Form数据域中的数据会丢失 */
|
||||
store.updateScaffoldData(form?.data, true);
|
||||
|
||||
// 控制按钮
|
||||
store.setScaffoldStep(step);
|
||||
@ -150,6 +152,7 @@ export class ScaffoldModal extends React.Component<SubEditorProps> {
|
||||
const form = this.amisScope?.getComponents()[0].props.store;
|
||||
const step = store.scaffoldFormStep - 1;
|
||||
form.setValueByName('__step', step);
|
||||
store.updateScaffoldData(form?.data, true);
|
||||
|
||||
// 控制按钮
|
||||
store.setScaffoldStep(step);
|
||||
|
@ -1695,6 +1695,20 @@ export const MainStore = types
|
||||
self.scaffoldError = msg;
|
||||
},
|
||||
|
||||
updateScaffoldData(value: any, replace?: boolean) {
|
||||
if (self.scaffoldForm && value) {
|
||||
self.scaffoldForm = {
|
||||
...self.scaffoldForm,
|
||||
value: replace
|
||||
? value
|
||||
: {
|
||||
...self.scaffoldForm.value,
|
||||
...value
|
||||
}
|
||||
};
|
||||
}
|
||||
},
|
||||
|
||||
openPopOverForm(context: PopOverFormContext) {
|
||||
self.popOverForm = context;
|
||||
},
|
||||
|
Loading…
Reference in New Issue
Block a user