【发布时间】:2013-11-20 18:07:53
【问题描述】:
我希望只有一个部分用于数组中的特定项目。例如:
var items = ['first','second']
例如:
{{#items[1]}}
Slightly different styling for the second item, for no difference other than it's the second item.
{{/items[1]}}
我试过了:
{{#items.1}}
Slightly different styling for the second item, for no difference other than it's the second item.
{{/items.1}}
还有:
{{#items}}
{{#0}}
Slightly different styling for the second item, for no difference other than it's the second item.
{{/0}}
{{/items}}
但这些都不起作用。
我真的不想制作像这样的对象:
{'1':'first','2':'second'}
因为那太恶心了。
有什么想法吗?
【问题讨论】:
标签: javascript mustache hogan.js