mirror of
https://gitee.com/baidu/amis.git
synced 2024-12-04 21:08:55 +08:00
merge 成一个 replace
This commit is contained in:
parent
385b77081f
commit
2b2a699bd4
@ -387,14 +387,14 @@ export const tokenize = (str: string, data: object, defaultFilter: string = '| h
|
||||
return str;
|
||||
}
|
||||
|
||||
return str
|
||||
.replace(/(\\)?\$(?:([a-z0-9_\.]+|&)|{([^}{]+?)})/gi, (_, escape) =>
|
||||
escape ? _.substring(1) : resolveVariableAndFilter(_, data, defaultFilter)
|
||||
)
|
||||
.replace(/\$\$/g, (_, index: number, source: string) => {
|
||||
return str.replace(/(\\)?\$(?:([a-z0-9_\.]+|&|\$)|{([^}{]+?)})/gi, (_, escape, key1, key2, index, source) => {
|
||||
if (!escape && key1 === '$') {
|
||||
const prefix = source[index - 1];
|
||||
return prefix === '=' ? encodeURIComponent(JSON.stringify(data)) : qsstringify(data);
|
||||
});
|
||||
}
|
||||
|
||||
return escape ? _.substring(1) : resolveVariableAndFilter(_, data, defaultFilter);
|
||||
});
|
||||
};
|
||||
|
||||
function resolveMapping(value: any, data: PlainObject) {
|
||||
|
Loading…
Reference in New Issue
Block a user