1
我试着去渲染基于变量名的谐音,根据these docs正确的方法是:使用var作为部分名称?
Subexpressions do not resolve variables so whichPartial must be a function. If a simple variable has the partial name, it's possible to resolve it via the lookup helper.
{{> (lookup . 'myVariable') }}
所以我曾尝试:
{{#each index.types}}
{{> (lookup . this.type) }}
{{/each}}
但我得到的错误:
Error: The partial undefined could not be found
我也在循环中输出以下内容:
{{this.type}}
正在读取正确的部分字符串。