1

由于我的 Handlebars JS 模板,我遇到了一个令人沮丧的错误。

Error: Parse error on line 9:
...      {{/each}}    {{/if}}
----------------------^
Expecting 'EOF'

有问题的车把:

{{if showSingle}}
    {{#with single}}
        {{> postSingle}}
    {{/with}}
{{else}}
   {{#each posts}}
        {{> postItem}}
    {{/each}}
{{/if}}

这样的嵌套是不可能的吗?

只是为了把事情放在上下文中,这工作得很好:

{{#each posts}}
    {{> postItem}}
{{/each}}
4

1 回答 1

2

缺少#第一个if

{{#if showSingle}}
    {{#with single}}
        {{> postSingle}}
    {{/with}}
{{else}}
   {{#each posts}}
        {{> postItem}}
   {{/each}}
{{/if}}
于 2012-10-05T22:21:05.480 回答