Polymer 2.0:铁图标在入门套件中不起作用

Polymer 2.0: iron-icon not working in Starter kit

我是 Polymer 项目的新手,我已经安装了 polymer 2.0 starterkit,除了 iron-icon 之外一切正常。当我 运行 项目时它不显示图标。

    <!-- Load the Polymer.Element base class -->
    <link rel="import" href="../bower_components/polymer/polymer-element.html">

    <script src="../bower_components/webcomponentsjs/webcomponents-lite.js"></script>
    <link rel="import" href="../bower_components/iron-icon/iron-icon.html">
    <link rel="import" href="../bower_components/iron-iconset-svg/iron-iconset-svg.html">

    <dom-module id="my-iconsset-view">
      <!-- Defines the element's style and local DOM -->
      <template>
        <style>
          :host {
            display: block;

            padding: 16px;
          }
        </style>

        <h1>My Iconsc</h1>

        <iron-icon icon="icon:menu"></iron-icon>
        <iron-icon icon="input"></iron-icon>


      </template>
      <script>
        // Your new element extends the Polymer.Element base class
        class MyIconssetView extends Polymer.Element {
          static get is() { return 'my-iconsset-view'; }
        }
        //Now, register your new custom element so the browser can use it
        customElements.define(MyIconssetView.is, MyIconssetView);
      </script>
    </dom-module>

导入 <link rel="import" href="../bower_components/iron-icons/iron-icons.html"> 而不仅仅是 iron-icon.

还有,你不用提icon="icon:menu",只要icon="menu"就可以了,除非你定义了自己的iconset并命名为'icon'。

The iron-icon element is used for displaying an icon.

iron-icons is a utility import that includes the definition for the iron-icon element, iron-iconset-svg element, as well as an import for the default icon set.