We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
重现 DEMO:
template-helper.js
var runtime = require('art-template/lib/runtime'); runtime.test = function (v1, v2) { return v2; }
index.js
var TplA = require('tpl/a/a.tpl'); var data = { list: [{ time: 1446175992278 }, { time: 1446176021568 }] }; require('tpl/template-helpers'); $('.js-desc').html(TplA(data));
a.tpl
{{each list as item}} <li>{{item.time | test: item.time}}</li> {{/each}}
报错信息:
4| {{each list as item}} 5| <li><a href="http://www.qq.com">{{item.time | dateFormat:'yyyy-MM-dd hh:mm:ss'}}</a></li> >> 6| <li>{{item.time | test: item.time}}</li> 7| {{/each}} 8| </ul> 9| </div> CompileError: Unexpected token . generated: $$out+=$escape($imports.test(item.time,item,.,time))
art-template 版本:4.11.0
环境版本:浏览器
The text was updated successfully, but these errors were encountered:
过滤器参数不支持使用 js 表达式,后续会改进。临时解决方案
{{each list as item}} {{set time = item.time}} <li>{{item.time | test: time}}</li> {{/each}}
Sorry, something went wrong.
嗯,我们用 set 变量来临时解决了。
我们在迁移到新版 art-template 时发现这个问题,旧版应该是支持 js 表达式的。
谢谢了。
fix bug #430
7eaac51
No branches or pull requests
重现 DEMO:
template-helper.js
index.js
a.tpl
报错信息:
art-template 版本:4.11.0
环境版本:浏览器
The text was updated successfully, but these errors were encountered: