mirror of
https://gitee.com/baidu/amis.git
synced 2024-12-05 05:28:37 +08:00
filter 改放第二个参数
This commit is contained in:
parent
116154d1b0
commit
6bfa6bc502
@ -53,10 +53,11 @@ export function evalExpression(expression: string, data?: object): boolean {
|
||||
|
||||
const fn = new Function(
|
||||
'data',
|
||||
'utils',
|
||||
`with(data) {${debug ? 'debugger;' : ''}return !!(${expression});}`
|
||||
);
|
||||
data = data || {};
|
||||
return fn.call(createObject(getFilters(), data), data);
|
||||
return fn.call(data, data, getFilters());
|
||||
} catch (e) {
|
||||
console.warn(e);
|
||||
return false;
|
||||
@ -68,10 +69,11 @@ export function evalJS(js: string, data: object): any {
|
||||
try {
|
||||
const fn = new Function(
|
||||
'data',
|
||||
'utils',
|
||||
`with(data) {${~js.indexOf('return') ? '' : 'return '}${js};}`
|
||||
);
|
||||
data = data || {};
|
||||
return fn.call(createObject(getFilters(), data), data);
|
||||
return fn.call(data, data, getFilters());
|
||||
} catch (e) {
|
||||
console.warn(e);
|
||||
return null;
|
||||
|
Loading…
Reference in New Issue
Block a user