vue配置font-awesome5的方法步骤
用yarn更新
yarn add @fortawesome/fontawesome yarn add @fortawesome/vue-fontawesome yarn add @fortawesome/fontawesome-free-solid yarn add @fortawesome/fontawesome-free-regular yarn add @fortawesome/fontawesome-free-brands
//***************font-awesome-start********************// 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) //***************font-awesome-end********************//
两种使用方式:
<i class="fas fa-user-tag icon"></i> <font-awesome-icon :icon="['fas', 'user']"></font-awesome-icon>