复杂结构的数组去重怎么操作

[
[
{"title":"11111111111","field":"","colspan":2,"rowspan":"1"},
{"title":"11111111111","field":"","colspan":2,"rowspan":"1"},
{"title":"22222222","field":"","colspan":"4","rowspan":"1"},
{"title":"22222222","field":"","colspan":"4","rowspan":"1"},
{"title":"22222222","field":"","colspan":"4","rowspan":"1"},
{"title":"22222222","field":"","colspan":"4","rowspan":"1"}
],
[
{"title":"3333333333","field":"","colspan":"2","rowspan":"1"},
{"title":"3333333333","field":"","colspan":"2","rowspan":"1"},
{"title":"4444444444","field":"","colspan":"3","rowspan":"1"},
{"title":"4444444444","field":"","colspan":"3","rowspan":"1"},
{"title":"4444444444","field":"","colspan":"3","rowspan":"1"},
{"title":"单位数量2","field":"单位数量2","colspan":"1","rowspan":"3"}
],
[
{"title":"中止1","field":"中止","colspan":"1","rowspan":"2"},
{"title":"单位数量3","field":"单位数量3","colspan":"1","rowspan":"2"},
{"title":"单位数量4","field":"单位数量4","colspan":"1","rowspan":"2"},
{"title":"555555555","field":"","colspan":"2","rowspan":"1"},
{"title":"555555555","field":"","colspan":"2","rowspan":"1"},
{"title":"单位数量2","field":"单位数量2","colspan":"1","rowspan":"3"}
],
[
{"title":"中止1","field":"中止","colspan":"1","rowspan":"2"},
{"title":"单位数量3","field":"单位数量3","colspan":"1","rowspan":"2"},
{"title":"单位数量4","field":"单位数量4","colspan":"1","rowspan":"2"},
{"title":"单位数量5","field":"单位数量5","colspan":"1","rowspan":"1"},
{"title":"单位数量6","field":"单位数量6","colspan":"1","rowspan":"1"},
{"title":"单位数量2","field":"单位数量2","colspan":"1","rowspan":"3"}
]
]
只保留第一次出现的后几次出现的删除
结果要变成这样
[
[
{"title":"11111111111","field":"","colspan":"3","rowspan":"1"},
{"title":"22222222","field":"","colspan":"4","rowspan":"1"}
],
[
{"title":"单位数量1","field":"单位数量1","colspan":"1","rowspan":"3"},
{"title":"3333333333","field":"","colspan":"2","rowspan":"1"},
{"title":"4444444444","field":"","colspan":"3","rowspan":"1"},
{"title":"单位数量2","field":"单位数量2","colspan":"1","rowspan":"3"}
],
[
{"title":"中止1","field":"中止","colspan":"1","rowspan":"2"},
{"title":"单位数量3","field":"单位数量3","colspan":"1","rowspan":"2"},
{"title":"单位数量4","field":"单位数量4","colspan":"1","rowspan":"2"},
{"title":"555555555","field":"","colspan":"2","rowspan":"1"}
],
[
{"title":"单位数量5","field":"单位数量5","colspan":"1","rowspan":"1"},
{"title":"单位数量6","field":"单位数量6","colspan":"1","rowspan":"1"}
]
]
LEATH
浏览 881回答 2
2回答

RISEBY

arr.map(items=>{varresult=[]items.forEach(item=>{if(!result.find(_item=>JSON.stringify(item)===JSON.stringify(_item))){result.push(item)}})returnresult})
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

JavaScript