如何使聚合物应用网格可点击

时间:2016-11-11 09:56:16

标签: polymer polymer-1.0 grid-layout

如何制作聚合物网格项目可以充当" a href"喜欢在材料设计规范(主要行动)?这是材料设计规范的链接:https://material.google.com/components/grid-lists.html#grid-lists-content

1 个答案:

答案 0 :(得分:1)

您是否阅读过docs?您可以使用div容器作为多个a链接,如下所示:

<dom-module id="grid-test">
  <template>
    <style include="app-grid-style">
      :host {
        --app-grid-columns: 3;
        --app-grid-item-height: 100px;
      }

      div {
        padding: 0;
        list-style: none;
      }

      .item {
        background-color: white;
        border: 1px solid black;
      }
    </style>

    <div class="app-grid">
      <a href="#" class="item">1</a>
      <a href="#" class="item">2</a>
      <a href="#" class="item">3</a>
      <a href="#" class="item">4</a>
      <a href="#" class="item">5</a>
      <a href="#" class="item">6</a>
      <a href="#" class="item">7</a>
      <a href="#" class="item">8</a>
      <a href="#" class="item">9</a>
      <a href="#" class="item">10</a>
      <a href="#" class="item">11</a>
      <a href="#" class="item">12</a>
      <a href="#" class="item">13</a>
      <a href="#" class="item">14</a>
    </div>
  </template>
  <script>
    Polymer({
      is: "grid-test"
    });
  </script>
</dom-module>