<li v-for="(item,index) in assign"
:key="index"
@click="selected(item)"
:class="{'active':item.isShow}">
selected(item) {
if (!item.isShow) {
item.isShow = true;
this.selectedList.push(item.id)
} else {
item.isShow = false;
let index = this.selectedList.indexOf(item.id);
if (index > -1) {
this.selectedList.splice(index, 1);
}
}
},
转载于:https://www.cnblogs.com/yaotu/p/10273126.html