vue 中的 fontawesome 在 vuejs 中不起作用
我尝试在我的 vue 项目中显示 fontawesome 我在 fontawesome 文档中执行了所有必需的步骤 我尝试在此处输入代码
编辑了一些教程,但它们都没有用 我在控制台中收到此错误
import { createApp } from 'vue'
import App from './App.vue'
import router from './router'
import './scss/main.scss'
import 'normalize.css'
/* import the fontawesome core */
import { library } from '@fortawesome/fontawesome-svg-core'
/* import specific icons */
import { faUserSecret } from '@fortawesome/free-solid-svg-icons'
/* import font awesome icon component */
import { FontAwesomeIcon } from '@fortawesome/vue-fontawesome'
/* add icons to the library */
library.add(faUserSecret)
/* add font awesome icon component */
createApp(App)
.use(router)
.mount('#app')
.component('font-awesome-icon', FontAwesomeIcon)
I tried to display fontawesome in my vue project I did all requierd steps in fontawesome documetations I trienter code here
ed few tutorials but they are all useless I got this error in the console
import { createApp } from 'vue'
import App from './App.vue'
import router from './router'
import './scss/main.scss'
import 'normalize.css'
/* import the fontawesome core */
import { library } from '@fortawesome/fontawesome-svg-core'
/* import specific icons */
import { faUserSecret } from '@fortawesome/free-solid-svg-icons'
/* import font awesome icon component */
import { FontAwesomeIcon } from '@fortawesome/vue-fontawesome'
/* add icons to the library */
library.add(faUserSecret)
/* add font awesome icon component */
createApp(App)
.use(router)
.mount('#app')
.component('font-awesome-icon', FontAwesomeIcon)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您需要在 mount() 函数之前使用 component() 函数
试试这个;
You need to use component() function before mount() function
try this;