使用vue-font-awesome在Vue CLI应用程序中显示Facebook图标

时间:2018-07-06 15:25:45

标签: vue.js font-awesome

我尝试过此-

    import { library } from '@fortawesome/fontawesome-svg-core'
    import { faFacebook } from '@fortawesome/free-solid-svg-icons'
    import { FontAwesomeIcon } from '@fortawesome/vue-fontawesome'

    library.add(faFacebook)

    Vue.component('font-awesome-icon', FontAwesomeIcon)

但是显然,免费的svg图标中没有faFacebook。如何包含Facebook图标?

2 个答案:

答案 0 :(得分:2)

我遇到了同样的问题。解决了这个问题:

terminal:
npm install --save @fortawesome/free-brands-svg-icons

main.js:
import { faFacebook } from '@fortawesome/free-brands-svg-icons'
library.add(faFacebook)

inside code:
<font-awesome-icon :icon="{ prefix: 'fab', iconName: 'facebook' }"/>

答案 1 :(得分:1)

检查fontawesome-free-brands中的faFacebookSquare

import { faFacebookSquare, faFacebookMessenger } from '@fortawesome/fontawesome-free-brands';

行得通吗?


编辑

只是看到faFacebookF也在那里,我只是错过了

import { faFacebookF } from '@fortawesome/fontawesome-free-brands';