0

我正在使用 Handlebars.js 获取我的轮播数据。我想知道如何使用 Handlebars 从轮播中获取当前活动项目。

<script id="template" type="text/x-handlebars-template">
    {{#each}}
          <div id="carousel-example-generic" class="carousel slide" data-ride="carousel">

          <!-- Wrapper for slides -->
          <div class="carousel-inner">
            {{#each}}
                {{this.title}}
            {{/each}}
          </div>

          <!-- Controls -->
          <a class="left carousel-control" href="#carousel-example-generic" role="button" data-slide="prev">
            <span class="glyphicon glyphicon-chevron-left"></span>
          </a>
          <a class="right carousel-control" href="#carousel-example-generic" role="button" data-slide="next">
            <span class="glyphicon glyphicon-chevron-right"></span>
          </a>

          <!-- Indicators -->
          <ol class="carousel-indicators">
            {{#each}}
                <li data-target="#carousel-example-generic" data-slide-to="{{this.id}}" {{#ifEquals this.id 1}} class="active" {{/ifEquals}}></li>
            {{/each}}
            <span id="number"> </span> 
          </ol>
        </div> <!-- Carousel -->
    {{/each}}
</script>

任何想法如何使用 Handlebars 检查当前活动的轮播?

4

0 回答 0