vue 数组去重
作者:互联网
test() { const arr = [ { name: '张三', age: 22 }, { name: '李四', age: 22 }, { name: '张三', age: 23 } ] const map = new Map() const qc = arr.filter(key => !map.has(key.name) && map.set(key.name, 1)) // 这里对name属性进行去重 console.log('qc') console.log(qc) }
标签:map,vue,const,name,age,数组,qc,key 来源: https://www.cnblogs.com/xfweb/p/15680748.html