在Vue 3中使用Font Awesome

14 浏览
0 Comments

在Vue 3中使用Font Awesome

我正在尝试在Vue 3中使用Font Awesome。

我已经在我的package.json文件中引入了它。

"dependencies": {

"@fortawesome/fontawesome-svg-core": "^1.2.34",

"@fortawesome/free-brands-svg-icons": "^5.15.2",

"@fortawesome/free-solid-svg-icons": "^5.15.2",

"@fortawesome/vue-fontawesome": "^3.0.0-3",

}

main.js中引入了FontAwesome。

import { createApp } from "vue";
import App from "./App.vue";
import router from "./router";
import store from "./store";
import { library } from "@fortawesome/fontawesome-svg-core";
import { faPhone } from "@fortawesome/free-solid-svg-icons/faAddressBook";
import { FontAwesomeIcon } from "@fortawesome/vue-fontawesome";
library.add(faPhone);
/* eslint-disable */
createApp(App)
  .use(store)
  .use(router)
    .component("font-awesome-icon", FontAwesomeIcon)
  .mount("#app")

在组件的