去重loadsh

泽泽生龙 / 2024-10-10 / 原文

1:多属性去重 

 

  const iteratee = (item) => {
          return item.productName + '|' + item.varietyName
        }
       const sumMethodListUniqBy = uniqBy(sumcompList.all(), iteratee)
 
 
2:单属性去重

       const sumMethodListUniqBy = uniqBy(sumcompList.all(), ‘xxx’)