mirror of
https://gitee.com/baidu/amis.git
synced 2024-12-02 03:58:07 +08:00
fix: 修复数据映射复杂写法没有正确返回原始数据的问题
This commit is contained in:
parent
c0e4b82ff9
commit
f933762415
@ -1,5 +1,15 @@
|
|||||||
|
import {parse} from 'amis-formula';
|
||||||
|
|
||||||
export function isPureVariable(path?: any): path is string {
|
export function isPureVariable(path?: any): path is string {
|
||||||
return typeof path === 'string'
|
if (typeof path === 'string') {
|
||||||
? /^\$(?:((?:\w+\:)?[a-z0-9_.][a-z0-9_.\[\]]*)|{[^}{]+})$/i.test(path)
|
try {
|
||||||
: false;
|
const ast = parse(path);
|
||||||
|
// 只有一个成员说明是纯表达式模式
|
||||||
|
return ast.body.length === 1;
|
||||||
|
} catch (err) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user