From 6f3833cbc566abc2a3906e7d4d14d6c54114fb74 Mon Sep 17 00:00:00 2001 From: qianchuan Date: Tue, 5 Jul 2022 16:21:49 +0800 Subject: [PATCH] =?UTF-8?q?fix:variables=E6=94=AF=E6=8C=81=E8=8E=B7?= =?UTF-8?q?=E5=8F=96=E4=B8=8A=E4=B8=8B=E6=96=87=E6=95=B0=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I7693263220b866ce8721ebcb146758dff3b25ede --- packages/amis-editor/src/renderer/FormulaControl.tsx | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/packages/amis-editor/src/renderer/FormulaControl.tsx b/packages/amis-editor/src/renderer/FormulaControl.tsx index c56695dfd..807228f96 100644 --- a/packages/amis-editor/src/renderer/FormulaControl.tsx +++ b/packages/amis-editor/src/renderer/FormulaControl.tsx @@ -24,7 +24,7 @@ import type { VariableItem, FuncGroup } from 'amis-ui/lib/components/formula/Editor'; -import type {FormControlProps} from 'amis-core'; +import {dataMapping, FormControlProps} from 'amis-core'; import type {BaseEventContext} from 'amis-editor-core'; import {EditorManager} from 'amis-editor-core'; @@ -159,6 +159,13 @@ export default class FormulaControl extends React.Component< return []; } + if ( + variables && + variables.some((item: any) => isExpression(item.children)) + ) { + variables = dataMapping(variables, this.props.data); + } + const {context, evalMode} = this.props; // 自身字段 const field = this.props?.data?.name;