fix: fix slot id is automatically generated every time

This commit is contained in:
liujuping 2023-02-24 14:49:32 +08:00 committed by 林熠
parent 1f09b639fb
commit 33a4192e2c
3 changed files with 6 additions and 2 deletions

View File

@ -401,7 +401,7 @@ export class Prop implements IProp, IPropParent {
slotSchema = { slotSchema = {
componentName: 'Slot', componentName: 'Slot',
title: value.title || value.props?.slotTitle, title: value.title || value.props?.slotTitle,
id: data.id, id: value.id,
name: value.name || value.props?.slotName, name: value.name || value.props?.slotName,
params: value.params || value.props?.slotParams, params: value.params || value.props?.slotParams,
children: value.children, children: value.children,

View File

@ -518,6 +518,7 @@ describe('Prop 类测试', () => {
type: 'JSSlot', type: 'JSSlot',
value: { value: {
componentName: 'Slot', componentName: 'Slot',
id: 'node_oclei5rv2e2',
props: { props: {
slotName: "content", slotName: "content",
slotTitle: "主内容" slotTitle: "主内容"
@ -534,6 +535,7 @@ describe('Prop 类测试', () => {
expect(slotProp.slotNode?.title).toBe('主内容'); expect(slotProp.slotNode?.title).toBe('主内容');
expect(slotProp.slotNode?.getExtraProp('name')?.getValue()).toBe('content'); expect(slotProp.slotNode?.getExtraProp('name')?.getValue()).toBe('content');
expect(slotProp.slotNode?.export()?.id).toBe('node_oclei5rv2e2');
slotProp.export(); slotProp.export();

View File

@ -170,7 +170,9 @@ class Renderer extends Component<{
this.startTime = Date.now(); this.startTime = Date.now();
this.schemaChangedSymbol = false; this.schemaChangedSymbol = false;
if (!container.autoRender || isRendererDetached()) return null; if (!container.autoRender || isRendererDetached()) {
return null;
}
const { intl } = createIntl(locale); const { intl } = createIntl(locale);