Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/reactjs/26.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 如何使用react big calendar的SlotPreggeter以特定的时间为特定的一天着色?_Javascript_Reactjs_Fullcalendar_React Big Calendar - Fatal编程技术网

Javascript 如何使用react big calendar的SlotPreggeter以特定的时间为特定的一天着色?

Javascript 如何使用react big calendar的SlotPreggeter以特定的时间为特定的一天着色?,javascript,reactjs,fullcalendar,react-big-calendar,Javascript,Reactjs,Fullcalendar,React Big Calendar,我有一个和我想得到相同的信息,如一天,开始和结束(作为一个时间),着色的时间和一天槽与slotPropGetter 我从后端获得的信息是: { "start": "2019-08-23T13:30:00", "end": "2019-08-23T18:00:00", "rendering": "background", "color": "#f740f7" } 我尝试使用slotpregetter: slotPropGette

我有一个和我想得到相同的信息,如一天,开始和结束(作为一个时间),着色的时间和一天槽与slotPropGetter

我从后端获得的信息是:

    {   "start": "2019-08-23T13:30:00",
        "end": "2019-08-23T18:00:00",
        "rendering": "background",
        "color": "#f740f7"
    }
我尝试使用
slotpregetter

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
                        }
                      }
                    }
                  }
                }
slotpregetter={
(日期)=>{

对于(设i=0;i在
视图中渲染每个
时隙
时,调用
slotprogetter
方法,传递的
日期
对象是插槽开始时间的完整日期/时间js
日期
对象。此方法被调用多少次,每小时一次在这些视图中,k由日历的
步骤
时隙
属性确定。因此,例如,默认的
步骤
30
时隙
2
,它将传递一个日期,该日期的调用时间为
HH:00
HH:30
HH
为实际24小时
hour
)。如果您将此更改为
15的
步骤
4的
时隙
,则该方法将每小时调用四次,每次递增十五分钟。您必须使用自己的日期数学来确定要调整的插槽单元格。

谢谢@Steve