fontawesome错误“找不到一个或多个图标"; [英] fontawesome error "Could not find one or more icon"

查看:259
本文介绍了fontawesome错误“找不到一个或多个图标";的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我关注了 https://fontawesome.com/如何使用/在网络上/与/vuejs一起使用.

但是当像这样使用它时:

But when use it like:

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"/>

知道:

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

Could not find one or more icon(s) {prefix: "fas", iconName: "twitter"}

推荐答案

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

free-brands-svg-icons use the fab prefix (docs don't appear to mention this, had to check its folder in node_modules), which you have to specify:

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

未指定时, fas前缀被假定为.

When non specified, fas prefix is assumed.

CodeSandbox: https://codesandbox.io/s/6j833qp57k

CodeSandbox: https://codesandbox.io/s/6j833qp57k

这篇关于fontawesome错误“找不到一个或多个图标";的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆