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)) ||