我想创建一个下拉菜单并在工具栏中添加注销按钮。但纸质菜单按钮在纸质工具栏中不起作用。
<paper-toolbar id="order-toolbar">
<template is="dom-if" if="[[ showHome ]]">
<img class="header-logo" on-tap="tileTapped" src="assets/paisool-logo.svg">
</template>
<template is="dom-if" if="[[ !showHome ]]">
<iron-icon id="back-arrow" class="header-logo" icon="arrow-back" on-tap="tileTapped"></iron-icon>
</template>
<h2 class="orders-heading">Store owner</h2>
<paper-menu-button>
<paper-icon-button id="header-menu-button" icon="more-vert" slot="dropdown-trigger"></paper-icon-button>
<paper-listbox slot="dropdown-content">
<paper-item>Share</paper-item>
<paper-item>Settings</paper-item>
<paper-item>Help</paper-item>
</paper-listbox>
</paper-menu-button>
</paper-toolbar>
答案 0 :(得分:1)
<paper-toolbar id="order-toolbar">
<template is="dom-if" if="[[ showHome ]]">
<img class="header-logo" on-tap="tileTapped" src="assets/paisool-logo.svg">
</template>
<template is="dom-if" if="[[ !showHome ]]">
<iron-icon id="back-arrow" class="header-logo" icon="arrow-back" on-tap="tileTapped"></iron-icon>
</template>
<h2 class="orders-heading">Store owner</h2>
<paper-menu-button>
<paper-icon-button id="header-menu-button" icon="more-vert" class="dropdown-trigger">
</paper-icon-button>
<paper-listbox slot="dropdown-content">
<paper-item>Share</paper-item>
<paper-item>Settings</paper-item>
<paper-item>Help</paper-item>
</paper-listbox>
</paper-menu-button>
</paper-toolbar>
我注意到您正在使用slot="dropdown-trigger"
。尝试使用class="dropdown-trigger"
。我认为slot
必须来自Polymer 2.0?