mirror of
https://gitee.com/baidu/amis.git
synced 2024-11-29 10:29:19 +08:00
fix: 修复 inputFormula evalMode false 时提交报错问题 (#9899)
This commit is contained in:
parent
6df3026f3c
commit
2d6ade5790
@ -22,7 +22,7 @@ order: 21
|
||||
"name": "formula",
|
||||
"label": "公式",
|
||||
"evalMode": true,
|
||||
"value": "SUM(1 , 2)",
|
||||
"value": "SUM(1 , user.id)",
|
||||
"variables": [
|
||||
{
|
||||
"label": "表单字段",
|
||||
@ -72,6 +72,20 @@ order: 21
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"label": "人员对象",
|
||||
"value": "user",
|
||||
"children": [
|
||||
{
|
||||
"label": "ID",
|
||||
"value": "user.id"
|
||||
},
|
||||
{
|
||||
"label": "用户名",
|
||||
"value": "user.name"
|
||||
},
|
||||
]
|
||||
},
|
||||
{
|
||||
"label": "长文本测试分类长文本测试分类长文本测试分类长文本测试分类",
|
||||
"children": [
|
||||
|
@ -344,7 +344,11 @@ export class FormulaPicker extends React.Component<
|
||||
|
||||
let ast: any;
|
||||
try {
|
||||
ast = parse(editorValue, {evalMode: true, allowFilter: false});
|
||||
ast = parse(editorValue, {
|
||||
// mixedMode 弹窗中的一定是表达式
|
||||
evalMode: this.props.mixedMode ? true : this.props.evalMode,
|
||||
allowFilter: false
|
||||
});
|
||||
} catch (error) {
|
||||
this.setState({isError: error?.message ?? true});
|
||||
return;
|
||||
@ -462,6 +466,7 @@ export class FormulaPicker extends React.Component<
|
||||
try {
|
||||
value &&
|
||||
parse(value, {
|
||||
// mixedMode 值是模版, 要 ${} 包裹表达式
|
||||
evalMode: this.props.mixedMode ? false : this.props.evalMode,
|
||||
allowFilter: false
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user