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;