<div class="content-box">
<span v-for="(item,index) in classListChan" :key="index" :class="[{active: checkedGroup.indexOf(index) > -1},'class-item']" @click="changeStyle(index)">{{item.className}}</span>
</div>
data () {
return {
checkedGroup: [],
classListChan:[],
}
},
//切换班级样式
changeStyle(index) {
if(this.checkedGroup.indexOf(index) == -1) {
this.checkedGroup.push(index);
}else {
var spliceIndex = this.checkedGroup.indexOf(index);
this.checkedGroup.splice(spliceIndex, 1);
}
},