From 10577aea68a63323bc1312faced84bcd5c616d1f Mon Sep 17 00:00:00 2001 From: roymondchen Date: Wed, 15 Jun 2022 12:44:37 +0800 Subject: [PATCH] =?UTF-8?q?fix(editor):=20page=E5=92=8Ccontainer=E9=BB=98?= =?UTF-8?q?=E8=AE=A4value=E5=8A=A0=E4=B8=8Aitems?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/editor/src/utils/props.ts | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/packages/editor/src/utils/props.ts b/packages/editor/src/utils/props.ts index 8a194602..35b9c132 100644 --- a/packages/editor/src/utils/props.ts +++ b/packages/editor/src/utils/props.ts @@ -243,9 +243,18 @@ export const DEFAULT_CONFIG: FormConfig = fillConfig([]); * @param type 组件类型 * @returns Object */ -export const getDefaultPropsValue = (type: string, id: string) => ({ - type, - id, - style: {}, - name: type, -}); +export const getDefaultPropsValue = (type: string, id: string) => + ['page', 'container'].includes(type) + ? { + type, + id, + style: {}, + name: type, + items: [], + } + : { + type, + id, + style: {}, + name: type, + };