定义
arr: [
[1, 2, 3],
[2, 3, 4],
[4, 5, 6],
[12, 3, 4],
[4, 25, 6],
[14, 25, 16],
[14, 15, 16],
[14, 15, 15, 116, 19],
],
newarr: [],
方法 //去重
quchong() {
var newArr = [];
for (var i = 0; i < this.arr.length; i++) {
for (var j = 0; j < this.arr[i].length; j++) {
var v = this.arr[i][j];
// 判断是否存在数组中,不存在在往下走
if (!newArr.includes(v)) {
newArr.push(v);
this.newarr = newArr;
}
}
}
},
网友评论