Web/vue.js
[vue.js] vue 연습 (2) - 동적 style/class, vue 계산식
0. 들어가기 -. vue를 이용한 style 속성 지정. -. 슬슬 복잡해진다..? 1. css style 지정방법 -. vue로 style 지정할 땐 style 구문이 조금 달라진다. 왜이런진 모르겠네... 복잡하게; /* html */ {{ item.name }} /* main.js */ items: [ {id: 1, name: 'name#1', color: "red"}, {id: 1, name: 'name#2', color: "blue"}, ], -. 위 예시와 같이, vue 구문으로 style 지정 시엔 v-bind:style="{ style 속성}" 이렇게 지정해야 한다. 이름도 css에선 background-color인데, backgroundColor 형태로 (camel 표기로) 변경된다. ..
2022. 1. 15. 23:26
최근댓글