<div v-for="(i, index) in schlist" v-if="showsch" :key="i.id" :class="{'box2' : i.checked}" class="box1">
<input type="checkbox" class="checkbox1" :checked="i.checked" @click="changeChecked(i.id)">
{{ i.title }}
</div>
.box1 {
height: 50px;
width: 90%;
border-radius: 6px;
margin-top: 10px;
padding: 13px 0;
&.box2 {
background-color: rgba(226, 236, 255, 1);
}
}
:class="{'box2' : i.checked}" class="box1"
i.checked为true,采用box2 样式,否则box1