reu*_*b87 5 meteor spacebars meteor-blaze
刚刚开始使用Meteor,所以我可能会遗漏一些基本的东西.在Meteor 1.2中,他们有{{@index}}
指令.
在模板中,如果我有:
...
{{#each items}}
{{@index}}
{{> childTemplate}}
{{/each}}
...
<template name="childTemplate">
{{@index}}
</template>
Run Code Online (Sandbox Code Playgroud)
该@index
主模板将工作,但一个在childTemplate不会.我使用它的工作是调用childTemplate传入@index
:
{{> childTemplate @index=@index}}
Run Code Online (Sandbox Code Playgroud)
这是正确的方法吗?还是有更多的东西?
是的,没关系
我在这里回答了一个类似的问题:-
但在这种情况下传递它是好的。
Meteor必须"../var"
到达父上下文,但那是模板上下文,而不是each块,所以我认为没有更多的meteor方式
归档时间: |
|
查看次数: |
377 次 |
最近记录: |