티스토리 뷰
아이콘을 적용하다가 도저히 괜찮은 아이콘이 없어 결국 폰트어썸으로 왔다.
...
https://fontawesome.com/docs/web/setup/get-started
Get Started
Font Awesome 6 brings loads of new icons and features to the most popular icon set in the world.
fontawesome.com
FontAwesome Docs 를 보면 제일 하단에 Vue 라고 있다.
Vue.js 에서 적용하는 방법이 나와있다.
npm i --save @fortawesome/fontawesome-svg-core
npm 기준으로 먼저 설치를 한 후
# 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
그러면 기본 아이콘은 설치가 된다.
https://fontawesome.com/docs/web/use-with/vue/
Set Up with Vue
Font Awesome 6 brings loads of new icons and features to the most popular icon set in the world.
fontawesome.com
클라이언트에서 적용하는 방법
main.js에서 설정을 해줘야 한다.
import { library } from "@fortawesome/fontawesome-svg-core";
import { fas } from "@fortawesome/free-solid-svg-icons";
import { far } from "@fortawesome/free-regular-svg-icons";
import { FontAwesomeIcon } from "@fortawesome/vue-fontawesome";
library.add(fas)
library.add(far)
이렇게 입력을 해주고 createApp 쪽에 추가를 해준다.
app.component('font-awesome-icon', FontAwesomeIcon)
그러고 컴포넌트에 html 로 작성을 해준다.
기억나는게 user 밖에 없어서 우선 입력을 해보았다.
<font-awesome-icon class="h-7 w-7" icon="user"></font-awesome-icon>
재실행을 해보니 아이콘이 잘 뜬다.
예전에 vue2 를 적용했을 때 보다 더욱 간결해진 느낌이다.
'개발일기' 카테고리의 다른 글
[PostgreSql] 컬럼 추가하기 (0) | 2023.01.25 |
---|---|
[PostgreSql] 다른 테이블 데이터로 수정하기 (0) | 2022.12.12 |
[Vue.Js] 라우터 이동하는 페이지의 이름 찾기 (0) | 2022.10.25 |
피그마에서 html, css 추출하기 (0) | 2022.10.24 |
제플린에서 피그마로 이동 (1) | 2022.10.24 |