Vue.js与FontAwesome版本5

时间:2018-01-12 11:21:54

标签: vue.js font-awesome

我正在尝试测试FontAwesome版本5(免费)图标显示..

我添加了3个包装

"@fortawesome/fontawesome": "^1.1.2",
"@fortawesome/fontawesome-free-brands": "^5.0.4",
"@fortawesome/fontawesome-free-regular": "^5.0.4",
"@fortawesome/fontawesome-free-solid": "^5.0.4"

我的HellowWorld.vue,我添加了以下测试:

<template>
    ...
    <div>
      <i class="fas faUser"></i>
      <i class="fas faCircle"></i>
      <i class="fas faFacebook"></i>
    </div>
</template>

<script>
    import fontawesome from '@fortawesome/fontawesome'
    import faUser from '@fortawesome/fontawesome-free-solid/faUser'
    import faCircle from '@fortawesome/fontawesome-free-regular/faCircle'
    import faFacebook from '@fortawesome/fontawesome-free-brands/faFacebook'
    fontawesome.library.add(faUser)
    fontawesome.library.add(faCircle)
    fontawesome.library.add(faFacebook)
    ...
</script>

但他们没有显示......我得到了闪烁的问号......

blinking question mark

可能有什么不对?感谢您的反馈

1 个答案:

答案 0 :(得分:0)

解决了!错误的类命名(前缀已更改...)

版本5应为

    <div>
      <i class="fas fa-user"></i>
      <i class="far fa-circle"></i>
      <i class="fab fa-facebook"></i>
    </div>

fonwt-awesome icons