19

我关注了 https://fontawesome.com/how-to-use/on-the-web/using-with/vuejs

但是当像这样使用它时:

import { library } from '@fortawesome/fontawesome-svg-core'
import { faBars } from '@fortawesome/free-solid-svg-icons'
import { faTwitter, faFacebook, faStackOverflow, faGithub } from '@fortawesome/free-brands-svg-icons'
import { FontAwesomeIcon } from '@fortawesome/vue-fontawesome'

...

library.add(faBars, faTwitter, faFacebook, faStackOverflow, faGithub )
Vue.component('font-awesome-icon', FontAwesomeIcon)

...

<font-awesome-icon icon="twitter" class="icon alt"/>

拿到:

找不到一个或多个图标 {prefix: "fas", iconName: "twitter"}

4

1 回答 1

47

free-brands-svg-icons使用fab前缀(文档似乎没有提到这一点,必须检查它在 node_modules 中的文件夹),您必须指定:

<font-awesome-icon :icon="['fab', 'twitter']" class="icon alt"/>

如果未指定,fas则假定为前缀

代码沙盒: https ://codesandbox.io/s/6j833qp57k

于 2018-07-06T10:42:38.817 回答