From c95e6181212d17568b716a323da5159f8d9390f6 Mon Sep 17 00:00:00 2001 From: "mario.gk" Date: Tue, 4 Aug 2020 19:29:49 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E5=85=BC=E5=AE=B9=20listSetter=20?= =?UTF-8?q?=E5=86=85=E9=83=A8=E5=8F=98=E9=87=8F=EF=BC=8C=E4=BF=AE=E5=A4=8D?= =?UTF-8?q?=E5=9B=9E=E9=80=80=20fieldId=20=E9=87=8D=E7=BD=AE=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/editor-preset-vision/src/deep-value-parser.ts | 8 ++++++++ packages/editor-preset-vision/src/editor.ts | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/packages/editor-preset-vision/src/deep-value-parser.ts b/packages/editor-preset-vision/src/deep-value-parser.ts index 227e5da09..e5270264a 100644 --- a/packages/editor-preset-vision/src/deep-value-parser.ts +++ b/packages/editor-preset-vision/src/deep-value-parser.ts @@ -3,11 +3,19 @@ import { isJSSlot, isI18nData, isJSExpression } from '@ali/lowcode-types'; import { isPlainObject } from '@ali/lowcode-utils'; import i18nUtil from './i18n-util'; +function isVariable(obj: any) { + return obj && obj.type === 'variable'; +} + // FIXME: 表达式使用 mock 值,未来live 模式直接使用原始值 export function deepValueParser(obj?: any): any { if (isJSExpression(obj)) { obj = obj.mock; } + // 兼容 ListSetter 中的变量结构 + if (isVariable(obj)) { + obj = obj.value; + } if (!obj) { return obj; } diff --git a/packages/editor-preset-vision/src/editor.ts b/packages/editor-preset-vision/src/editor.ts index a24b57c61..efc0a895e 100644 --- a/packages/editor-preset-vision/src/editor.ts +++ b/packages/editor-preset-vision/src/editor.ts @@ -100,7 +100,7 @@ designer.addPropsReducer((props, node) => { // FIXME! item.name could be 'xxx.xxx' const ov = props[item.name]; const v = item.initial(node as any, getRealValue(ov)); - if (v !== undefined) { + if (!ov && v !== undefined) { if (isVariable(ov)) { newProps[item.name] = { ...ov,