fix:variables支持获取上下文数据

Change-Id: I7693263220b866ce8721ebcb146758dff3b25ede
This commit is contained in:
qianchuan 2022-07-05 16:21:49 +08:00
parent 29bd6b5e91
commit 6f3833cbc5

View File

@ -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;