[Vue] class 바인딩 여러개 하기

딱이·2021년 8월 31일
0

basic class binding

<button type="button" :class="{ active: isActive }" @click="click()" >버튼</button>
					

+ 여러개의 class를 바인딩

: 다양한 조건에 따라 클래스를 통해 기능을 활성화 시키거나 CSS 처리를 하고 싶을 경우

++ 배열로 바인딩

<button type="button" @click="click()" :class="[{ start: status === 'start' }, { end: status === 'end' }]">
 버튼
</button>
					

++ comma로 구분해 바인딩

<button type="button" @click="click()" :class="{ start: status === 'start', end: status === 'end' }">
 버튼
</button>
profile
뚝딱뚝딱 FE

0개의 댓글