如何在 SCA(Handlebars)模板语言中嵌套 for 循环?
例如; 我有一个数组数组,我想遍历内部数组元素:
// Loop 1
{{#each footerNavigationLinks}}
<ul class="footer-content-nav-list">
// Nested loop
{{#each objectToAtrributes item}}
<li>aa
<a {{objectToAtrributes item}}>
{{text}}
</a>
</li>
{{/each}}
</ul>
{{/each}}
footerNavigationLinks
是一个数组数组:
footerNavigationLinks: [
[
{text: 'Link a', href:'#'}
, {text: 'Link b', href:'#'}
, {text: 'Link c', href:'#'}
],
[
{text: 'Link a', href:'#'}
, {text: 'Link b', href:'#'}
, {text: 'Link c', href:'#'}
]
]