【问题标题】:fontawesome with vue do not work in vuejsvue 的 fontawesome 在 vuejs 中不起作用
【发布时间】:2022-10-17 06:00:24
【问题描述】:

我试图在我的 vue 项目中显示 fontawesome 我在 fontawesome 文档中做了所有必需的步骤我 trienter code hereed 了一些教程,但它们都没有用我在控制台中遇到了这个错误

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)

这是控制台中的错误

【问题讨论】:

  • 这不是你向 Vue 添加组件的方式,你应该先阅读 Vue/Font Awesome 文档。

标签: javascript css vue.js frontend font-awesome


【解决方案1】:

尝试这个;

创建应用程序(应用程序) .use(路由器) .component('font-awesome-icon', FontAwesomeIcon) .mount('#app')

【讨论】:

    猜你喜欢
    • 2019-01-30
    • 2021-09-10
    • 1970-01-01
    • 2021-12-02
    • 2021-04-25
    • 1970-01-01
    • 2020-05-24
    • 2015-06-21
    • 2019-12-30
    相关资源
    最近更新 更多