【发布时间】:2020-09-11 07:35:57
【问题描述】:
我正在使用受Full Calendar 启发的react-big-calendar 来显示事件列表。我能够在日历中显示一个硬编码的日期,但我正在努力显示一个开始和结束时间的对象。我将如何映射此信息列表以便显示所有事件。日历显示this.state.events 中的事件。
这是我要显示的数据列表:
(7) [{…}, {…}, {…}, {…}, {…}, {…}, {…}]
0: {start: "2020-09-16 17:00:00", end: "2020-09-16 17:15:00"}
1: {start: "2020-09-16 17:15:00", end: "2020-09-16 17:30:00"}
2: {start: "2020-09-16 17:30:00", end: "2020-09-16 17:45:00"}
3: {start: "2020-09-16 17:45:00", end: "2020-09-16 18:00:00"}
4: {start: "2020-09-16 18:00:00", end: "2020-09-16 18:15:00"}
5: {start: "2020-09-16 18:15:00", end: "2020-09-16 18:30:00"}
6: {start: "2020-09-16 18:30:00", end: "2020-09-16 18:45:00"}
这是我当前的代码:
class SchedulePage extends Component {
constructor(props) {
super(props);
this.state = {
events: [
{
start: start_date,
end: end_date,
title: "15 minute interview",
},
],
};
}
render() {
return (
<div className="calendar-container">
<Calendar
localizer={localizer}
events={this.state.events}
style={{ height: "100vh" }}
onSelectEvent={this.test}
/>
</div>
);
}
}
【问题讨论】:
标签: javascript reactjs jsx react-big-calendar