猿问

选日期的时候提取相邻的日期天数?


checkList:[
                    {
                        date:'2019-01-01',
                        num:1,
                        roomId:1
                    },
                    {
                        date:'2019-01-02',
                        num:1,
                        roomId:1
                    },
                    {
                        date:'2019-01-03',
                        num:1,
                        roomId:1
                    },
                    {
                        date:'2019-01-05',
                        num:1,
                        roomId:1
                    },
                    {
                        date:'2019-01-03',
                        num:1,
                        roomId:2
                    },
                    {
                        date:'2019-01-04',
                        num:1,
                        roomId:2
                    }
                ],
                checkList2:[
                    {
                        date:'2019-01-01',
                        num:3,
                        roomId:1
                    },
                    {
                        date:'2019-01-05',
                        num:1,
                        roomId:1
                    },
                    {
                        date:'2019-01-03',
                        num:2,
                        roomId:2
                    }
                ]
最终我想把list这个初始数据变成list2这样的数据要怎么弄,num是天数,roomId是房间id

qq_浅仓小星_0
浏览 910回答 2
2回答
随时随地看视频慕课网APP
我要回答