* vue3버전 기준으로 cli로 설치하기
1. Add SVG Core
npm i --save @fortawesome/fontawesome-svg-core
2. Add Icon Packages
# Free icons styles
npm i --save @fortawesome/free-solid-svg-icons
npm i --save @fortawesome/free-regular-svg-icons
npm i --save @fortawesome/free-brands-svg-icons
# Pro icons styles
npm i --save @fortawesome/pro-solid-svg-icons
npm i --save @fortawesome/pro-regular-svg-icons
npm i --save @fortawesome/pro-light-svg-icons
npm i --save @fortawesome/pro-thin-svg-icons
npm i --save @fortawesome/pro-duotone-svg-icons
npm i --save @fortawesome/sharp-solid-svg-icons
npm i --save @fortawesome/sharp-regular-svg-icons
npm i --save @fortawesome/sharp-light-svg-icons
3. Add the Vue Component
# for Vue 3.x
npm i --save @fortawesome/vue-fontawesome@latest-3
4. C:\workspace_vue\todoapp\src\main.js
import { createApp } from 'vue'
import App from './App.vue'
import { library } from '@fortawesome/fontawesome-svg-core'
/* import specific icons */
import { fas } from '@fortawesome/free-solid-svg-icons'
/* import font awesome icon component */
import { FontAwesomeIcon } from '@fortawesome/vue-fontawesome'
/* add icons to the library */
library.add(fas)
createApp(App)
.component('font-awesome-icon', FontAwesomeIcon)
.mount('#app')
* 사용하기
<span class="addContainer" v-on:click="addTodo">
<font-awesome-icon icon="fa-solid fa-plus" class="addBtn"/>
</span>
참고)
-vue에 cli로 설치관련
https://fontawesome.com/docs/web/use-with/vue/
-solid 아이콘 종류
https://fontawesome.com/search?o=r&m=free&s=solid&f=classic
'Web > vue' 카테고리의 다른 글
[vue] TransitionGroup (0) | 2023.05.02 |
---|---|
[vue] TODO App 만들기_1 (0) | 2023.05.01 |
[vue] 뷰 CLI / 뷰 로더 웹팩(Webpack) (0) | 2023.04.30 |
[vue] Form 입력 바인딩 (v-model) (0) | 2023.04.29 |
[vue] vscode에 vue 셋팅 (0) | 2023.04.27 |