this.choiceJson = []
let arr2 = this.choiceJson.filter((alone, index) => {
let arraids = []
this.choiceJson.forEach((item, i) => {
arraids.push(item.productId)
})
return arraids.indexOf(alone.productId) === index
})
this.choiceJson = arr2
数组比较去重
uniq (arr) {
let temp = []
let index = []
// let array = [...arr, ...this.selectNode]
let array = [...this.selectNode, ...arr]
let l = array.length
for (var i = 0; i < l; i++) {
for (var j = i + 1; j < l; j++) {
if (array[i].id === array[j].id) {
i++
j = i
}
}
temp.push(array[i])
index.push(i)
}
return temp
},