Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

是否支持动态添加过滤器? #4

Closed
zcoding opened this issue May 2, 2017 · 2 comments
Closed

是否支持动态添加过滤器? #4

zcoding opened this issue May 2, 2017 · 2 comments

Comments

@zcoding
Copy link

zcoding commented May 2, 2017

目前过滤器只能通过 imports 选项传给 art-template ,这里主要有两个问题:

  1. 在开发环境,如果在 webpack 运行期间添加过滤器,webpack 并不会更新过滤器,模板文件访问过滤器失败,通过重新启动 webpack 才能获取到
  2. 初始化过滤器的代码,并不能使用 import 语法,导致这部分代码难以维护(因为我的业务代码用了 babel+ES2015,导致没办法在初始化过滤器的代码中复用业务代码)

我是参考 example 里面的方式做的,不知道是不是我的方式有误,求指教~

另:我个人的想法是, art-template 应该支持动态添加过滤器,而不是必须通过 options 初始化所有的过滤器。

@aui
Copy link
Owner

aui commented May 3, 2017

好建议,我考虑优化这里。不降低性能损耗的同时支持运行时载入过滤器

aui added a commit to aui/art-template that referenced this issue May 4, 2017
2. 过滤器语法可以直接使用全局对象,无需特别声明。例如 `{{url | encodeURIComponent}}`
@aui
Copy link
Owner

aui commented May 4, 2017

已经支持,使用请见 README.md

@aui aui closed this as completed May 4, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants