3

有没有办法在其父布局中访问子布局中定义的 YFM 属性?

例如,给定一个子布局 page.hbs:

---
layout: wrapper.hbs
no_header: true
----
<div class="wrapper">{{> body }}</div>

我想访问no_header父布局 wrapper.hbs 中 page.hbs 中定义的 YFM 属性:

<html>
    <body>
        {{#unless layout.no_header}}<header></header>{{/if}}
        {{> body }}
    </body>
</html>
4

1 回答 1

1

前面的事情合并了,所以你应该能够在上下文的根上得到它。

尝试做{{#unless no_header}}

编辑:根据下面的评论更新。

于 2014-05-26T13:53:41.070 回答