淡语

导航

vue使用Font Awesome5

1. 安装基础依赖

  1. $ npm i --save @fortawesome/fontawesome
   2. $ npm i --save @fortawesome/vue-fontawesome

2. 安装样式依赖

  1. $ npm i --save @fortawesome/fontawesome-free-solid
  2. $ npm i --save @fortawesome/fontawesome-free-regular

 

   3.$ npm i --save @fortawesome/fontawesome-free-brands
 
 
3.全局引入,修改main.js
    import fontawesome from '@fortawesome/fontawesome'
    import {FontAwesomeIcon} from '@fortawesome/vue-fontawesome'
    import solid from '@fortawesome/fontawesome-free-solid'
    import regular from '@fortawesome/fontawesome-free-regular'
    import brands from '@fortawesome/fontawesome-free-brands'
     
    fontawesome.library.add(solid)
    fontawesome.library.add(regular)
    fontawesome.library.add(brands)
     
    Vue.component('font-awesome-icon', FontAwesomeIcon)
 
4.图标使用
<font-awesome-icon :icon="['fas','angle-down']"/>
       
 

 

 

posted on 2020-07-29 17:19  object360  阅读(847)  评论(0编辑  收藏  举报