我正在尝试在把手中使用查找功能来传递动态部分,但它并不适合我。
我的数据是:
{
"sections": [
"about",
"when",
"where"
]}
模板看起来像:
{{#each copy.sections}}
<section class='section' id='section-{{this}}' aria-labelledby='hed-{{this}}'>
<h2 class='section__hed' id='hed-{{this}}'>{{this}}</h2>
{{> graphic/(lookup . 'this') }} // Need to render this dynamically
</section>
{{/each}}
基本上我希望查找解析为:
{{> graphic/about}}
,{{> graphic/when}}
和{{> graphic/where}}
答案 0 :(得分:0)
如果您的数据是:
var copy = {
"sections": [
"about",
"when",
"where"
]};
您只需指定{{#each sections }}
而不是{{#each copy.sections}}
:
{{#each sections}}
<section class='section' id='section-{{this}}' aria-labelledby='hed-{{this}}'>
<h2 class='section__hed' id='hed-{{this}}'>{{this}}</h2>
graph/{{ this }}
</section>
{{/each}}
我无法理解你的代码{{> graphic/(lookup . 'this') }}
,它没有有效的语法,所以我假设你要做的是graph/{{ this }}
。