如何删除聚合物中最后一项的 <hr> 标签 dom-repeat
how to remove <hr> tag for last last item in polymer dom-repeat
这是我的代码
<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>
我正在使用 paper-listbox 和 paper item 创建一个下拉菜单,
我对纸质项目使用 dom-repeat 并且正在使用 dom-if[ 检查纸质项目是否为子菜单=20=](_isSubMenu() 是一个检查纸项是否为子菜单的函数),我使用
标签来分隔列表框中的纸项,但我不想要 hr 标签在列表框中的最后一个纸项目之后
在您的 Polymer 模板样式中使用 :last-of-type
来定位最后一个 <hr>
:
hr:last-of-type { display: none; }
这是我的代码
<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>
我正在使用 paper-listbox 和 paper item 创建一个下拉菜单,
我对纸质项目使用 dom-repeat 并且正在使用 dom-if[ 检查纸质项目是否为子菜单=20=](_isSubMenu() 是一个检查纸项是否为子菜单的函数),我使用
标签来分隔列表框中的纸项,但我不想要 hr 标签在列表框中的最后一个纸项目之后
在您的 Polymer 模板样式中使用 :last-of-type
来定位最后一个 <hr>
:
hr:last-of-type { display: none; }