new Map() + filter方法
let myMap = new Map()
let arr = arrList.filter(item => {
return !myMap.has(item) && myMap.set(item, 1)
})
//如果有重复值,过滤的数组长度则大于1,继而将Id设为true
if (arr.length > 1) {
this.arrId = true
} else {
this.arrId = false
}
}
new Map() + filter方法
let myMap = new Map()
let arr = arrList.filter(item => {
return !myMap.has(item) && myMap.set(item, 1)
})
//如果有重复值,过滤的数组长度则大于1,继而将Id设为true
if (arr.length > 1) {
this.arrId = true
} else {
this.arrId = false
}
}