https://v3-docs.vuejs-korea.org/guide/essentials/class-and-style.html
클래스와 스타일 바인딩 | Vue.js
v3-docs.vuejs-korea.org
클래스와 스타일 바인딩
클래스를 동적으로 토글하기 위해 객체를 :class(v-bind:class의 줄임말)에 전달할 수 있다
data() {
return {
isActive: true,
hasError: false
}
}
<div
class="static"
:class="{ active: isActive, 'text-danger': hasError }"
></div>
<div class="static active"></div>
data() {
return {
styleObject: {
color: 'red',
fontSize: '13px'
}
}
}
<div :style="styleObject"></div>
'VUE.JS' 카테고리의 다른 글
[VUE.JS] 이벤트 핸들링(Event Handling), 이벤트 수식어, 키 수식어 (0) | 2023.02.10 |
---|---|
[VUE.JS] 조건부 렌더링(Conditional Rendering), 리스트 렌더링(List Rendering) (0) | 2023.02.09 |
[VUE.JS] COMPUTED, 캐싱, Getter, Setter, Watch (0) | 2023.02.09 |
[VUE.JS] 템플릿 문법 (0) | 2023.02.09 |
[VUE.JS] VUE.JS STYLE ERROR (0) | 2023.02.09 |