如何在纸质工具栏中使用聚合物纸张菜单按钮?

时间:2017-06-26 06:42:31

标签: polymer polymer-1.0

我想创建一个下拉菜单并在工具栏中添加注销按钮。但纸质菜单按钮在纸质工具栏中不起作用。

  <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>

1 个答案:

答案 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?