mirror of
https://github.com/alibaba/lowcode-engine.git
synced 2026-01-13 09:41:57 +00:00
fix: set i18n setter value when change mixed setter
This commit is contained in:
parent
b298c18a94
commit
72d81c2d65
@ -142,8 +142,19 @@ export default class MixedSetter extends Component<{
|
||||
// dirty fix vision variable setter logic
|
||||
private hasVariableSetter = this.setters.some((item) => item.name === 'VariableSetter');
|
||||
|
||||
private getDefaultValueWhenUseSetter(oldUsed?: string): any {
|
||||
if (this.used === 'I18nSetter') {
|
||||
return {
|
||||
type: 'i18n',
|
||||
zh_CN: '',
|
||||
en_US: '',
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private useSetter = (name: string) => {
|
||||
const { field, onChange } = this.props;
|
||||
const oldUsed = this.used;
|
||||
if (name === 'VariableSetter') {
|
||||
const setterComponent = getSetter('VariableSetter')?.component as any;
|
||||
if (setterComponent && setterComponent.isPopup) {
|
||||
@ -156,7 +167,10 @@ export default class MixedSetter extends Component<{
|
||||
}
|
||||
const setter = this.setters.find((item) => item.name === name);
|
||||
this.used = name;
|
||||
if (setter) {
|
||||
const newValue = this.getDefaultValueWhenUseSetter(oldUsed);
|
||||
if (newValue !== undefined) {
|
||||
onChange && onChange(newValue);
|
||||
} else if (setter) {
|
||||
this.handleInitial(setter);
|
||||
}
|
||||
};
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user