如何对后台返回数据处理成相邻数据展示?-灵析社区

脑袋困掉惹

先按 `appeal_type` 排序, 再在 `appeal_type` 排序的基础上排序 `detail_appeal_type`: `const sortedList = list.toSorted((a, b) => a.appeal_type -b.appeal_type).toSorted((a, b) => a.detail_appeal_type -b.detail_appeal_type)` 或者排序字段多的话, 可以这样写: `const sortedList = ['appeal_type', 'detail_appeal_type'].reduce((acc, field) => acc.toSorted((a, b) => a[field] - b[field]), list)` ![image.png](https://wmprod.oss-cn-shanghai.aliyuncs.com/c/user/20241009/5c68fca79ced89f6f4e80fa65addad8d.png)

阅读量:1

点赞量:0

问AI