【发布时间】:2018-05-10 15:30:18
【问题描述】:
我想使用 fontawesome 图标。我有以下网络组件,但未显示图标:
<link rel="import" href="../../bower_components/polymer/polymer-element.html">
<script defer src="https://use.fontawesome.com/releases/v5.0.6/js/all.js"></script>
<dom-module id="mi-icono">
<template>
<i class="fas fa-address-card"></i>
<i class="fas fa-trash-alt"></i>
</template>
<script>
/**
* @customElement
* @polymer
*/
class MiIcono extends Polymer.Element {
static get is() { return 'mi-icono'; }
static get properties() {
return {};
}
}
window.customElements.define(MiIcono.is, MiIcono);
</script>
</dom-module>
有谁知道为什么不显示图标?
【问题讨论】:
-
我也有同样的问题,如果您找到解决方案,请告诉我。我对这两个答案都投了反对票,因为您使用的是 SVG + JS FA 图标(就像我一样)并且他们使用的是纯 css + webfonts,这不是您的问题,也不是您的代码中的纯 JS ......我认为它与shadow-root,因为 JS 可以使用任何聚合物 dom 模块之外的图标..