【发布时间】:2020-03-21 20:40:18
【问题描述】:
我有一个react-big-calendar,我想获得相同的信息,例如日期、开始和结束(作为时间),以便使用 slotPropGetter 为时间和日期槽着色。
我的后台信息是:
{ "start": "2019-08-23T13:30:00",
"end": "2019-08-23T18:00:00",
"rendering": "background",
"color": "#f740f7"
}
我尝试使用slotPropGetter:
slotPropGetter={
(date) => {
for(let i =0; i<this.state.eventsPlanning.length; i++) {
if(this.state.eventsPlanning[i].rendering === 'background') {
let newStyle ={
backgroundColor:'red'
}
return {
className: "rbc-day-slot rbc-time-slot",
style: newStyle
}
}
}
}
}
当我运行它时,似乎所有的日子都被着色了,但我只想根据信息的start和end着色。
我该如何解决这个问题?
【问题讨论】:
标签: javascript reactjs fullcalendar react-big-calendar