gpt4 book ai didi

javascript - 如何在 Angular 中按服务器分组

转载 作者:行者123 更新时间:2023-11-30 19:00:21 26 4
gpt4 key购买 nike

<分区>

代码如下:

list.component.ts

 data = [   {
"id": 19,
"server": "Server 1",
"dl": "35.88 Mbit/s",
"ul": "46.76 Mbit/s",
},
{
"id": 30,
"server": "Server 1",
"dl": "45.06 Mbit/s",
"ul": "48.25 Mbit/s",
},
{
"id": 26,
"server": "Server 1",
"dl": "47.96 Mbit/s",
"ul": "47.89 Mbit/s",
} ]

如何对Server 1进行分组?

输出应该是

{
server: 'Server 1',
data: [
{
"id": 19,
"dl": "35.88 Mbit/s",
"ul": "46.76 Mbit/s",
},
{
"id": 30,
"dl": "45.06 Mbit/s",
"ul": "48.25 Mbit/s",
},
{
"id": 26,
"dl": "47.96 Mbit/s",
"ul": "47.89 Mbit/s",
}
]
}

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com