我正在制作一个日历,可以预订房间并显示项目里程碑

问题描述 投票:0回答:1

如何在事件中放置 2 个事件,以便在日历中显示里程碑和预订。我试着这样说:

events={milestones.map(milestone => {
                        return {
                            id: milestone.id,
                            title: milestone.description,
                            start: milestone.expectedDate
                        };
                    })/*, this.state.reservations*/}

这样做只会显示里程碑,但如果我这样说:

events={/*milestones.map(milestone => {
                        return {
                            id: milestone.id,
                            title: milestone.description,
                            start: milestone.expectedDate
                        };
                    })*/ this.state.reservations}

它只显示预订情况。我怎样才能以一种方式显示它们呢?

我试着这样说,但它仍然只显示第一个:

events={milestones.map(milestone => {
                        return {
                            id: milestone.id,
                            title: milestone.description,
                            start: milestone.expectedDate
                        };
                    }) , this.state.reservations}
javascript fullcalendar
1个回答
0
投票

我终于解决了问题!

events={[...milestones.map(milestone => ({
                            id: milestone.id,
                            title: milestone.description,
                            start: milestone.expectedDate
                        })), ...this.state.reservations]}
© www.soinside.com 2019 - 2024. All rights reserved.