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}}
正在讀取正確的部分字符串。