根据对象数组中某一属性删除该项
作者:互联网
方法一:
//根据对象数组中某一属性删除该项
removeByValue(arr, attr, value){
var index = 0;
for(var i in arr){
if(arr[i][attr] == value){
index = i;
arr.splice(index,1);
break;
}
}
},
方法二:
//controlSN为数组对象中某一对象的某一属性
let objArrData = [{},{}]
objArrData.map((item, index) => {
if (item.controlSN == '000006') {
objArrData.splice(index, 1);
}
});
array.splice(index, howmany, item1, ....., itemX)
标签:index,arr,splice,删除,该项,数组,var,objArrData 来源: https://blog.csdn.net/u011565547/article/details/122294122