fix prop getValue

This commit is contained in:
kangwei 2020-03-16 20:40:11 +08:00
commit 99d1962748
4 changed files with 16 additions and 16 deletions

View File

@ -74,7 +74,7 @@ export default class Prop implements IPropParent {
if (type === 'list') { if (type === 'list') {
if (!this._items) { if (!this._items) {
return this._items; return this._value;
} }
return this.items!.map(prop => { return this.items!.map(prop => {
const v = prop.export(serialize); const v = prop.export(serialize);
@ -172,8 +172,12 @@ export default class Prop implements IPropParent {
this.dispose(); this.dispose();
} }
getValue(serialize = true) { @computed getValue(): CompositeValue {
// todo: const v = this.export(true);
if (v === UNSET) {
return null;
}
return v;
} }
private dispose() { private dispose() {

View File

@ -31,12 +31,14 @@ export default class EventsSetter extends Component<{
selectType: null, selectType: null,
nativeEventList: [], nativeEventList: [],
lifeCycleEventList: [], lifeCycleEventList: [],
eventDataList: [], eventDataList: this.props.value || [],
isShowEventDialog: false, isShowEventDialog: false,
bindEventName: '', bindEventName: '',
relatedEventName: '', relatedEventName: '',
}; };
// TODO: getDerivedStateFromProps recieve eventDataList from prop.value
componentWillMount() { componentWillMount() {
this.initEventBtns(); this.initEventBtns();
this.initEventList(); this.initEventList();
@ -239,10 +241,7 @@ export default class EventsSetter extends Component<{
} }
}); });
this.props.onChange(eventDataList); this.props.onChange(eventDataList);
// field.setValue(eventDataList);
this.closeDialog(); this.closeDialog();
}; };

View File

@ -455,7 +455,7 @@ export class SettingsMain implements SettingTarget {
if (this.nodes.length < 1) { if (this.nodes.length < 1) {
return null; return null;
} }
return this.nodes[0].getProp(propName, false)?.value; return this.nodes[0].getProp(propName, true)?.getValue();
} }
/** /**
@ -471,7 +471,7 @@ export class SettingsMain implements SettingTarget {
if (this.nodes.length < 1) { if (this.nodes.length < 1) {
return null; return null;
} }
return this.nodes[0].getExtraProp(propName, false)?.value; return this.nodes[0].getExtraProp(propName, false)?.getValue();
} }
setExtraPropValue(propName: string, value: any) { setExtraPropValue(propName: string, value: any) {

View File

@ -419,15 +419,12 @@ registerMetadataTransducer(metadata => {
getValue(field: SettingField, val?:any[]) { getValue(field: SettingField, val?:any[]) {
return val; return val;
let data = field.parent.getPropValue('eventDataList');
return data;
}, },
setValue(field: SettingField, eventDataList: any[]) { setValue(field: SettingField, eventDataList: any[]) {
return; return;
// console.info(eventDataList);
console.info(eventDataList); // field.parent.setPropValue('eventDataList', eventDataList);
field.parent.setPropValue('eventDataList', eventDataList);
}, },
}, },
], ],