Home > other >  How to use Font Awesome 5 on VueJS in laravel project
How to use Font Awesome 5 on VueJS in laravel project

Time:10-25

I'm trying to use Font Awesome with Vue laravel project.

I have it in my package.json

"devDependencies": {
        "@fortawesome/fontawesome-free": "^5.15.4",
        "axios": "^0.21.4",
        "bootstrap": "^4.6.0",
        "jquery": "^3.6",
        "laravel-mix": "^6.0.34",
        "lodash": "^4.17.19",
        "popper.js": "^1.16.1",
        "postcss": "^8.3.11",
        "resolve-url-loader": "^3.1.4",
        "sass": "^1.43.3",
        "sass-loader": "^11.0.1",
        "vue": "^2.6.14",
        "vue-loader": "^15.9.8",
        "vue-template-compiler": "^2.6.14"
    },

Imported FontAwesome in main.js

import { library } from '@fortawesome/fontawesome-svg-core'
import { faSpinner } from '@fortawesome/free-solid-svg-icons'
import { FontAwesomeIcon } from '@fortawesome/vue-fontawesome'

I am Use:

<i class="fas fa-ellipsis-v"></i>

But Not Show Icon !!

CodePudding user response:

Read document https://github.com/FortAwesome/vue-fontawesome

You need add to main.js

Vue.component('font-awesome-icon', FontAwesomeIcon)

and use tag <font-awesome-icon icon="***" />

Example:

<font-awesome-icon icon="ellipsis-v" />
  • Related