buttonGroup 数据同步问题

This commit is contained in:
liaoxuezhi 2019-11-28 22:59:01 +08:00
parent f624448dde
commit 78879d5266
2 changed files with 6 additions and 4 deletions

View File

@ -137,7 +137,8 @@ export default class ButtonGroupControl extends React.Component<
@OptionsControl({
type: 'button-group',
sizeMutable: false
sizeMutable: false,
strictMode: false
})
export class ButtonGroupControlRenderer extends ButtonGroupControl {
render() {

View File

@ -15,7 +15,8 @@ import {
isObject,
isVisible,
createObject,
extendObject
extendObject,
cloneObject
} from '../../utils/helper';
import debouce = require('lodash/debounce');
import flatten = require('lodash/flatten');
@ -323,13 +324,13 @@ export default class Form extends React.Component<FormProps, object> {
// 先拿出来数据,主要担心 form 被什么东西篡改了,然后又应用出去了
// 之前遇到过问题,所以拿出来了。但是 options loadOptions 默认值失效了。
// 所以目前需要两个都要设置一下,再 init Hook 里面。
const data = {...store.data};
const data = cloneObject(store.data);
store.setInited(true);
const hooks: Array<(data: any) => Promise<any>> = this.hooks['init'] || [];
await Promise.all(hooks.map(hook => hook(data)));
onInit && onInit(extendObject(store.data, data), this.props);
onInit && onInit(data, this.props);
submitOnInit &&
this.handleAction(