需要:前提是table展现list数组的全副数据,要求移除操作后,在list数组中删除该条数据。
//移除办法
deleteBatch(elecId) {
console.log(this.valList, 'valList1'); //移除前数组
this.valList.forEach((value, index, array) => {
if (value.elecId == elecId) { //判断条件
array.splice(index, 1) //删除符合条件的数据
}
})
console.log(this.valList, 'valList2'); //移除后数组
},
发表回复