mirror of
https://github.com/alibaba/lowcode-engine.git
synced 2025-12-12 03:01:16 +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) {
|
setAsSlot(data: JSSlot) {
|
||||||
this._type = 'slot';
|
this._type = 'slot';
|
||||||
let slotSchema: SlotSchema;
|
let slotSchema: SlotSchema;
|
||||||
// 当 data.value 的结构为 { componentName: 'Slot' } 时,直接当成 slotSchema 使用
|
// 当 data.value 的结构为 { componentName: 'Slot' } 时,复用部分 slotSchema 数据
|
||||||
if ((isPlainObject(data.value) && data.value?.componentName === 'Slot')) {
|
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 {
|
} else {
|
||||||
slotSchema = {
|
slotSchema = {
|
||||||
componentName: 'Slot',
|
componentName: 'Slot',
|
||||||
|
|||||||
@ -162,7 +162,14 @@ export type RootSchema = PageSchema | ComponentSchema | BlockSchema;
|
|||||||
export interface SlotSchema extends NodeSchema {
|
export interface SlotSchema extends NodeSchema {
|
||||||
componentName: 'Slot';
|
componentName: 'Slot';
|
||||||
name?: string;
|
name?: string;
|
||||||
|
title?: string;
|
||||||
params?: string[];
|
params?: string[];
|
||||||
|
props?: {
|
||||||
|
slotTitle?: string;
|
||||||
|
slotName?: string;
|
||||||
|
slotParams?: string[];
|
||||||
|
};
|
||||||
|
children?: NodeSchema[];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user