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

etpl里解析参数不支持表达式 #74

Open
anyexinglu opened this issue Jan 16, 2017 · 1 comment
Open

etpl里解析参数不支持表达式 #74

anyexinglu opened this issue Jan 16, 2017 · 1 comment

Comments

@anyexinglu
Copy link

8f9aa76a44538ba7ebd0866c83587dab

似乎只能用var,感到很不方便…

@anyexinglu anyexinglu changed the title etpl里渲染参数不支持表达式 etpl里解析参数不支持表达式 Jan 16, 2017
@wslx520
Copy link

wslx520 commented Feb 10, 2017

嗯,这个问题一直存在。在es6推出了模板字符串后,这问题就表现得更扎眼了,因为模板字符串中经常这么干:here is the result ${a+b},而在etpl中这样就不能用了。感觉反差太明显

看了etpl的源码后发现,etpl用 ${user.name}来输出变量时,需要做一系列处理,要防止 undefined 被拼入结果,最终编译后${user.name}会变成 getVariable('user', 'name')。这也导致要实现你说的功能变得很麻烦

就看etpl的构建人如何改进了,否则的确只能使用 var

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