把手如何用if引用{{lookup this ../name}}

时间:2017-05-05 09:30:53

标签: handlebars.js

每个循环有两个,外循环'字段' '名称'内部循环使用{{lookup this ../name}}引用值并正确呈现。每个{{../message}}都可以包含元素{{name}}。我希望' {{查找此../name}}'为null或未定义,不提供任何内容而不是空格。我希望有一个简单的方法来解决这个问题。我试图在该区域周围使用{{#if this ../name}} {{/ if}但是产生了错误,例如。

{{#each ../message}}
  {{#if this ../name}}
     <a href = "https://issues.jboss.org/browse/{{key}}"> 
     <button class="mini ui blue button"><i class="key icon"></i> {{key}}</button></a>
     <button class="mini ui blue basic button">{{lookup this ../name}}</button><br>
  {{/if}}
{{/each}}

TypeError: Cannot read property 'includeZero' of undefined

以下是代码。

  <div class="ui raised segment">
    <div class="ui styled accordion">
        <div class="title">
            <i class="dropdown icon"></i>
            Results
        </div>
        <div class="content">
            <p class="transition hidden">
            <div class="ui styled accordion">
                {{#each fields}}
                <div class="title">
                    <i class="dropdown icon"></i>
                    {{name}}
                </div>
                <div class="content">
                    <p class="transition hidden">
                            {{#each ../message}}
                              <a href = "https://issues.jboss.org/browse/{{key}}"> <button class="mini ui blue button"><i class="key icon"></i> {{key}} </button></a>
                                    <button class="mini ui blue basic button">{{lookup this ../name}}</button><br>
                            {{/each}}
                    </p>
                </div>
               {{/each}}
            </div>
            </p>
        </div>

0 个答案:

没有答案