mirror of
https://gitee.com/baidu/amis.git
synced 2024-11-30 02:58:05 +08:00
ComboForm 初始值考虑 flat 的情况
This commit is contained in:
parent
43be1f5529
commit
4f2d758a3b
@ -277,8 +277,14 @@ export default class ComboControl extends React.Component<ComboProps> {
|
||||
store.forms.forEach(item => item.items.forEach(item => item.unique && item.syncOptions()));
|
||||
}
|
||||
|
||||
handleSingleFormChange(values: object) {
|
||||
this.props.onChange({
|
||||
...values
|
||||
});
|
||||
}
|
||||
|
||||
handleFormInit(index: number, values: any) {
|
||||
const {syncDefaultValue, disabled} = this.props;
|
||||
const {syncDefaultValue, disabled, flat, joinValues, delimiter} = this.props;
|
||||
|
||||
if (syncDefaultValue === false || disabled) {
|
||||
return;
|
||||
@ -286,20 +292,14 @@ export default class ComboControl extends React.Component<ComboProps> {
|
||||
|
||||
let value = this.getValueAsArray();
|
||||
|
||||
value.splice(index, 1, {
|
||||
...value[index],
|
||||
...values
|
||||
});
|
||||
value[index] = flat ? values.flat : {...values};
|
||||
|
||||
if (flat && joinValues) {
|
||||
value = value.join(delimiter || ',');
|
||||
}
|
||||
this.props.onChange(value);
|
||||
}
|
||||
|
||||
handleSingleFormChange(values: object) {
|
||||
this.props.onChange({
|
||||
...values
|
||||
});
|
||||
}
|
||||
|
||||
handleSingleFormInit(values: any) {
|
||||
this.props.syncDefaultValue !== false &&
|
||||
this.props.setPrinstineValue &&
|
||||
|
Loading…
Reference in New Issue
Block a user