用map + filter去重之后只剩一条数据了,并且控制台打印输出"[object Object]"
unique (arr, key) {
const res = new Map()
let arr1 = arr.filter((item) => !res.has(item[key]) && res.set(item[key], 1))
return arr1
}
this.option = this.unique(this.selectData, this.selectData.text)
console.log('this.option', this.option)