纸张菜单按钮未显示在纸张工具栏中

时间:2017-03-08 12:16:39

标签: polymer polymer-1.0

我是Polymer的新手,我正在尝试在纸质工具栏中使用纸质菜单按钮来重现Kevin Schaaf在Polymer Summit 2015上展示的内容,但事实证明该元素未显示。贝娄是我的代码:

<link rel="import" href="../bower_components/iron-icons/iron-icons.html">
<link rel="import" href="../bower_components/polymer/polymer.html">
<link rel="import" href="../bower_components/paper-toolbar/paper-toolbar.html">
<link rel="import" href="../bower_components/paper-input/paper-input.html">
<link rel="import" href="../bower_components/paper-icon-button/paper-icon-button.html">
<link rel="import" href="../bower_components/paper-menu-button/paper-menu-button.html">

<dom-module id="input-header">
  <template>
    <paper-toolbar>
      <paper-icon-button icon="mail"></paper-icon-button>
      <div>{{title}}</div>
      <paper-menu-button>
        <paper-icon-button icon="more-vert"></paper-icon-button>
        <paper-input label="Thread name:" value="{{title}}"></paper-input>
      </paper-menu-button>
    </paper-toolbar>
  </template>

  <script>
    Polymer({
      is: 'input-header',
      properties: {
        label: {
          type: String,
          notify: true
        }
      }
    });
  </script>
</dom-module>

我做错了什么?提前谢谢。

2 个答案:

答案 0 :(得分:2)

课程很重要。此外,您还没有定义下拉内容类的纸质菜单。我不确定是否有纸张输入???

<paper-menu-button>
  <paper-icon-button icon="menu" class="dropdown-trigger"></paper-icon-button>
  <paper-menu class="dropdown-content">
    <paper-item>Share</paper-item>
    <paper-item>Settings</paper-item>
    <paper-item>Help</paper-item>
  </paper-menu>
</paper-menu-button>

答案 1 :(得分:0)

我不知道你在尝试什么。在paper-input内使用paper-menu-button应该显示一些项目对我来说没有意义,但无论如何,如果你想在paper-icon-button内看到paper-menu-button,你必须添加下拉触发类。

代码应该是:

   <paper-toolbar>
      <paper-icon-button icon="mail"></paper-icon-button>
      <div>{{title}}</div>
      <paper-menu-button>
        <paper-icon-button icon="more-vert" class="dropdown-trigger"></paper-icon-button>
        <paper-input label="Thread name:" value="{{title}}"></paper-input>
      </paper-menu-button>
    </paper-toolbar>

纸质菜单按钮应该有一些下拉内容,这就是为什么我没有得到它。

也许在divpaper-icon-button周围使用一些包paper-input并为其设置dropdown-trigger类