1、数组对象根据某个属性去重(根据id去重)
this.list = arr.reduce((all,next)=>all.some((item)=>item.id==next.id)?all:[...all,next],[])
2、将数组对象中某两个属性提取出来组成key:value格式
list:[ {},{},{} ] nameList:{id:name}
this.list.forEach(({id,name})=>this.nameList[id]=name)
3.数组对象按照某个属性排序(根据mode排序)
this.modeArea = [{mode:2,area:10},{mode:1,area:20},{mode:4,area:50},{mode:3,area:1},]
this.modeArea.sort((a, b) => { return a.mode - b.mode; });
4.快速清空对象的值
Object.keys(this.data).forEach(key=>(this.data[key] = ''))
不定期更新中......