조언 감사합니다. 덕분에 해결했어요!
클래스 안에 조건문 거는 방법도 알게 되었구요.
<template>
<div style="margin:10px; width:100px;">
<div @click="누름(i)" v-for="(a, i) in 데이터" :key="i"
:class="{'css': i === 누른번호, 'button':true}">
{{ a }}
</div>
</div>
</template>
<script>
export default {
name: 'Test-a',
data () {
return {
데이터: ["버튼1", "버튼2", "버튼3", "버튼4", "버튼5"],
누른번호:0
}
},
methods: {
누름(i){
this.누른번호=i
}
},
}
</script>
<style scoped>
.css {
color: red;
}
.button{
text-align : center;
border : 1px solid black
}
</style>