mirror of
https://github.com/alibaba/lowcode-engine.git
synced 2025-12-14 13:03:07 +00:00
fix: reuse JSSlot data's value when it is slot structure
This commit is contained in:
parent
bcaad576b3
commit
b18b70461c
@ -173,7 +173,7 @@ export class Prop implements IPropParent {
|
|||||||
const values = this.items!.map((prop) => {
|
const values = this.items!.map((prop) => {
|
||||||
return prop.export(stage);
|
return prop.export(stage);
|
||||||
});
|
});
|
||||||
if (values.every(val => val === undefined)) {
|
if (values.every((val) => val === undefined)) {
|
||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
return values;
|
return values;
|
||||||
@ -314,14 +314,21 @@ export class Prop implements IPropParent {
|
|||||||
@action
|
@action
|
||||||
setAsSlot(data: JSSlot) {
|
setAsSlot(data: JSSlot) {
|
||||||
this._type = 'slot';
|
this._type = 'slot';
|
||||||
const slotSchema: SlotSchema = {
|
let slotSchema: SlotSchema;
|
||||||
componentName: 'Slot',
|
// 当 data.value 的结构为 { componentName: 'Slot' } 时,直接当成 slotSchema 使用
|
||||||
title: data.title,
|
if ((isPlainObject(data.value) && data.value?.componentName === 'Slot')) {
|
||||||
id: data.id,
|
slotSchema = data.value as SlotSchema;
|
||||||
name: data.name,
|
} else {
|
||||||
params: data.params,
|
slotSchema = {
|
||||||
children: data.value,
|
componentName: 'Slot',
|
||||||
};
|
title: data.title,
|
||||||
|
id: data.id,
|
||||||
|
name: data.name,
|
||||||
|
params: data.params,
|
||||||
|
children: data.value,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
if (this._slotNode) {
|
if (this._slotNode) {
|
||||||
this._slotNode.import(slotSchema);
|
this._slotNode.import(slotSchema);
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user