如何删除聚合物dom-repeat中最后一项的<hr />标签

时间:2017-10-26 06:09:28

标签: javascript polymer-2.x

这是我的代码

<div class="dropdown" id="dropdown">
   <a href="{{data.path}}">
      <button id="myButton" class="dropbtn">{{data.name}}</button>
   </a>
   <paper-listbox id="menuListBox" class="dropdown-content" slot="dropdown-
              content" selected="1">
      <template is="dom-repeat" items="{{data.submenu}}">
          <paper-item id="subMenu">
             <template is="dom-if" if="{{_isSubMenu(item.submenu.length)}}">
                <geo-dropdownmenu class="submenu" data={{item}} animation-
                      direction="right" menu="submenu"></geo-dropdownmenu>
             </template>
             <template is="dom-if" if="{{!_isSubMenu(item.submenu.length)}}">
               <a href="{{item.path}}" id="paperItemType"> {{item.name}} </a>
             </template>
             </paper-item>
                   <hr>
          </template>
   </paper-listbox>

</div>

这里正在使用纸质列表框和纸质项目创建一个下拉菜单, 我正在使用 dom-repeat 作为纸质项目,并使用 dom-if 检查纸质项目是否为子菜单(_isSubMenu()是检查是否为我是使用


标签来分隔列表框中的纸质项目,但我不希望在列表框中的最后一个纸项目之后使用hr标记

1 个答案:

答案 0 :(得分:0)

在Polymer模板的样式中使用:last-of-type来定位最后一个<hr>

hr:last-of-type { display: none; }

demo

相关问题