From 74530d9ef1fd8e7904cb4691814398de23bf6c67 Mon Sep 17 00:00:00 2001 From: wibetter <365533093@qq.com> Date: Fri, 14 Oct 2022 12:11:34 +0800 Subject: [PATCH] =?UTF-8?q?fix(amis-saas-7103):=20=E5=AE=8C=E5=96=84?= =?UTF-8?q?=E5=BC=80=E5=85=B3=E7=BB=84=E4=BB=B6=E9=BB=98=E8=AE=A4=E5=80=BC?= =?UTF-8?q?=E7=B1=BB=E5=9E=8B=E6=A0=A1=E9=AA=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I08a1eabf77fbc783ec328fab2387ccaddca7bfbc --- packages/amis-editor/src/renderer/FormulaControl.tsx | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/packages/amis-editor/src/renderer/FormulaControl.tsx b/packages/amis-editor/src/renderer/FormulaControl.tsx index f1ec7ef4f..30610ecca 100644 --- a/packages/amis-editor/src/renderer/FormulaControl.tsx +++ b/packages/amis-editor/src/renderer/FormulaControl.tsx @@ -219,6 +219,7 @@ export default class FormulaControl extends React.Component< if (value === null || value === undefined) { return true; // 数值为空不进行类型识别 } + const {rendererSchema} = this.props; const expectType = this.props.valueType; if (expectType === null || expectType === undefined) { @@ -228,7 +229,10 @@ export default class FormulaControl extends React.Component< // 当前数据域 const curData = this.getContextData(); - if ( + if (rendererSchema.type === 'switch' && (rendererSchema.trueValue !== undefined || rendererSchema.falseValue !== undefined)) { + // 开关类型组件单独处理 + return rendererSchema.trueValue === value || rendererSchema.falseValue === value; + } else if ( (expectType === 'number' && isNumber(value)) || (expectType === 'boolean' && isBoolean(value)) || (expectType === 'object' && isPlainObject(value)) ||