본문 바로가기
IT/Vue.js

css module

by 봉즙 2020. 7. 28.

컴포넌트에서 CSS를 모듈화 하여 사용

 

<style module>을 이용하여 모듈화 시키면 동적형태로 CSS 를 사용할 수 있다

모듈화 시킨 css는 $style을 이용하여 사용할 수 있다.

<template>  
	<button v-on:class="$style.test"> 버튼 </button>
</template>

<script></script> 

<style module> 
	.test {
		background-color: red;
		color: #FFFFFFF;
	} 
</style>

 

'IT > Vue.js' 카테고리의 다른 글

컴포넌트에 데이터 넣기 - chart.js  (0) 2020.05.04
Router  (0) 2020.05.04
Vue.js, 컴포넌트  (0) 2020.05.04

댓글