mirror of
https://github.com/alibaba/lowcode-engine.git
synced 2025-12-10 18:03:01 +00:00
fix: compatible with SlotSchema which doesn't have title / name / params
This commit is contained in:
parent
064e842382
commit
3fe9882f9d
@ -315,9 +315,17 @@ export class Prop implements IPropParent {
|
||||
setAsSlot(data: JSSlot) {
|
||||
this._type = 'slot';
|
||||
let slotSchema: SlotSchema;
|
||||
// 当 data.value 的结构为 { componentName: 'Slot' } 时,直接当成 slotSchema 使用
|
||||
// 当 data.value 的结构为 { componentName: 'Slot' } 时,复用部分 slotSchema 数据
|
||||
if ((isPlainObject(data.value) && data.value?.componentName === 'Slot')) {
|
||||
slotSchema = data.value as SlotSchema;
|
||||
const value = data.value as SlotSchema;
|
||||
slotSchema = {
|
||||
componentName: 'Slot',
|
||||
title: value.title || value.props?.slotTitle,
|
||||
id: data.id,
|
||||
name: value.name || value.props?.slotName,
|
||||
params: value.params || value.props?.slotParams,
|
||||
children: data.value,
|
||||
} as SlotSchema;
|
||||
} else {
|
||||
slotSchema = {
|
||||
componentName: 'Slot',
|
||||
|
||||
@ -162,7 +162,14 @@ export type RootSchema = PageSchema | ComponentSchema | BlockSchema;
|
||||
export interface SlotSchema extends NodeSchema {
|
||||
componentName: 'Slot';
|
||||
name?: string;
|
||||
title?: string;
|
||||
params?: string[];
|
||||
props?: {
|
||||
slotTitle?: string;
|
||||
slotName?: string;
|
||||
slotParams?: string[];
|
||||
};
|
||||
children?: NodeSchema[];
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user