①
this.targetKeys = [...new Set(this.targetKeys)]
②
//去重并排序
let hash = {}
this.barStaFundData = this.barStaFundData.reduce((item, next) => {
hash[next.year] ? '' : hash[next.year] = true && item.push(next)
return item
}, []).sort(compare('year'))
export function compare(property){
return (a,b)=>{
let valueA = a[property]
let valueB = b[property]
console.log( valueA - valueB,valueA)
return valueA - valueB
}
}