使用{{#each}}在一维数组访问值 [英] Access values using {{#each}} in a one dimensional array
本文介绍了使用{{#each}}在一维数组访问值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我发现了很多使用的例子 {{#}每个}
帮手迭代多维数组,但我无法弄清楚如何在一个一维阵列来访问每个值
例如,利用这个数组:
技巧:设计,发展,HTML5,CSS,JavaScript的'],
我如何输出的每个项目,并在助手像下面?
模板:Handlebars.compile(
'< DIV>' +
{{#each技能}} {{the_item_output}} {{/每}}'+
'< / DIV>'
)
什么我需要把放置 {{} the_item_output}
来看看实际的项目?
解决方案
{{#每个人}}
<立GT; {{}这个}< /李>
{{/每}}
I've found a lot of examples of using the {{#each}}
helper to iterate over multi-dimensional arrays, but I can't figure out how to access each value in a one-dimensional array.
For example, take this array:
skills: ['Design', 'Development', 'HTML5', 'CSS', 'JavaScript'],
How do I output each item, in a helper like below?
template: Handlebars.compile(
'<div>' +
'{{#each skills}} {{ the_item_output }} {{/each}}' +
'</div>'
),
What do I need to put in placed of {{ the_item_output }}
to see the actual item?
解决方案
{{#each people}}
<li>{{this}}</li>
{{/each}}
这篇关于使用{{#each}}在一维数组访问值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文