Polymer 1.0:样式<paper-toolbar>

时间:2015-11-27 23:21:41

标签: polymer polymer-1.0 paper-elements

请提供正在使用的JSBin ,以使<paper-toolbar>&#34;看起来很漂亮&#34;如下:

  • <paper-input><paper-dropdown-menu>元素垂直居中<paper-toolbar>的中间。
  • <paper-input><paper-dropdown-menu>水平输入字段彼此垂直对齐
  • 水平空间彼此之间的<paper-input><paper-dropdown-menu>元素至少20px

Link to JSBin

http://jsbin.com/hiwoqapawu/edit?html,output
<html>

<head>
  <title>My Element</title>

  <script data-require="polymer@*" data-semver="1.0.0" src="http://www.polymer-project.org/1.0/samples/components/webcomponentsjs/webcomponents-lite.js"></script>
  <script data-require="polymer@*" data-semver="1.0.0" src="http://www.polymer-project.org/1.0/samples/components/polymer/polymer.html"></script>
  <base href="http://element-party.xyz/" />
  <link rel="import" href="all-elements.html" />
</head>

<body>
  <dom-module id="my-element">
    <style>
      paper-toolbar {
        background: var(--paper-blue-100);
      }
    </style>
    <template>
      <paper-toolbar>
        <paper-input id="search" label="Search">
          <iron-icon icon="search" prefix></iron-icon>
          <paper-icon-button suffix icon="clear"></paper-icon-button>
        </paper-input>
        <paper-dropdown-menu label="Sort by">
          <paper-menu class="dropdown-content">
            <paper-item>Foo</paper-item>
            <paper-item>Bar</paper-item>
            <paper-item>Qux</paper-item>
          </paper-menu>
        </paper-dropdown-menu>
      </paper-toolbar>
    </template>
    <script>
      Polymer({
        is: "my-element"
      });
    </script>
  </dom-module>

  <my-element></my-element>
</body>

</html>

1 个答案:

答案 0 :(得分:0)

Link to JSBin

http://jsbin.com/bumisimali/edit?html,output
<html>

<head>
  <title>My Element</title>

  <script data-require="polymer@*" data-semver="1.0.0" src="http://www.polymer-project.org/1.0/samples/components/webcomponentsjs/webcomponents-lite.js"></script>
  <script data-require="polymer@*" data-semver="1.0.0" src="http://www.polymer-project.org/1.0/samples/components/polymer/polymer.html"></script>
  <base href="http://element-party.xyz/" />
  <link rel="import" href="all-elements.html" />
</head>

<body>
  <dom-module id="my-element">
    <style>
      paper-toolbar {
        background: var(--paper-blue-100);
        @apply(--layout-around-justified);
      }
      paper-dropdown-menu, paper-input {
        @apply(--layout-self-end);
      }
    </style>
    <template>
      <paper-toolbar>
        <div class="flex"></div>
        <paper-input id="search" label="Search">
          <iron-icon icon="search" prefix></iron-icon>
          <paper-icon-button suffix icon="clear"></paper-icon-button>
        </paper-input>
        <div class="flex"></div>
        <paper-dropdown-menu label="Sort by">
          <paper-menu class="dropdown-content">
            <paper-item>Foo</paper-item>
            <paper-item>Bar</paper-item>
            <paper-item>Qux</paper-item>
          </paper-menu>
        </paper-dropdown-menu>
        <div class="flex"></div>
      </paper-toolbar>
    </template>
    <script>
      Polymer({
        is: "my-element"
      });
    </script>
  </dom-module>

  <my-element></my-element>
</body>

</html>