pra*_*432 5 variables handlebars.js
我将模型传递给车把模板并将一些属性连接起来.我希望每行都有一些位置变量.具体来说,我想知道已创建了多少行并且每行都有一个位置.
例如
{{#each row}}
<span class = (indexHere)>
<tr>
<td> <{{this.property}}>
</tr>
</span>
{{/each}}
Run Code Online (Sandbox Code Playgroud)
这是一个古老的问题,也许当时Handlebars没有包含该@index属性,但根据当前(1.3.0)文档:
循环遍历项目时each,您可以选择引用当前循环索引{{@index}}
| 归档时间: |
|
| 查看次数: |
7621 次 |
| 最近记录: |