vue选中与取消简单实现
<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);
}
}
},