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

能否在template里面自定义局部变量? #43

Closed
viccici opened this issue Aug 7, 2013 · 1 comment
Closed

能否在template里面自定义局部变量? #43

viccici opened this issue Aug 7, 2013 · 1 comment

Comments

@viccici
Copy link

viccici commented Aug 7, 2013

您好,请问,我能在在模板里面定义局部变量吗?情况如下:

js data:
var json = { person:[{ 0 : { name:'test' ...... } ,1 : { name:'text' .......} }] };

template:
{@each person as p,index}
${p[index].name}
请问我能为p[index]定义一个局部变量吗?
{@/each}

@viccici viccici closed this as completed Aug 8, 2013
@PaulGuo
Copy link
Owner

PaulGuo commented Aug 8, 2013

模板内可以内嵌micro-template语法,所以暂时可以通过<% var temp = p[index]; %>定义局部变量,而后就可以通过${temp}输出。

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