优化 tpl 引入方式

This commit is contained in:
2betop 2020-01-07 20:11:15 +08:00
parent e173c92e98
commit 6f62ad8b44
2 changed files with 3 additions and 3 deletions

View File

@ -35,7 +35,7 @@ function lodashCompile(str: string, data: object) {
defaultValue: filters.defaut,
...imports
};
delete imports.default; // default 是个关键字,不能 imports 到 lodash 里面去。
delete finnalImports.default; // default 是个关键字,不能 imports 到 lodash 里面去。
const fn = template(str, {
imports: finnalImports,
variable: 'data'

View File

@ -15,6 +15,8 @@ export function reigsterTplEnginer(name: string, enginer: Enginer) {
enginers[name] = enginer;
}
[registerBulitin, registerLodash].forEach(fn => fn());
export function filter(
tpl?: string,
data: object = {},
@ -75,5 +77,3 @@ export function evalJS(js: string, data: object): any {
return null;
}
}
[registerBulitin, registerLodash].forEach(fn => fn());