import { Component, OnInit } from '@angular/core'; @Component({ selector: 'app-plan-adjustment', templateUrl: './plan-adjustment.component.html', styleUrls: ['./plan-adjustment.component.scss'] }) export class PlanAdjustmentComponent implements OnInit { constructor() { } list = [ { tag: "行政许可", class: "#42B983", item: [ { name: "想啥吃啥餐饮有限公司", checked: false }, { name: "想啥吃啥餐饮有限公司", checked: false } ] }, { tag: "双随机", class: "#1D9DFF", item: [ { name: "想啥吃啥餐饮有限公司", checked: false } ] }, ] list2 = [ ] taskNumber=0 task=false ngOnInit(): void { } aaa(data) { if(data.checked){ this.list2.push({meu:this.list2.length,data}) console.log(this.list2); this.taskNumber=this.list2.length if(this.taskNumber==8){ this.task=true } }else{ this.bbb(data) } } bbb(e) { console.log(e); e.checked=false for (let index = 0; index < this.list2.length; index++) { if(e==this.list2[index].data){ this.list2.splice(this.list2[index].meu,1) this.taskNumber=this.list2.length } } } }