FullCalendar 4反背景

时间:2019-04-17 10:20:15

标签: fullcalendar-4

我在FullCalendar v4.0.2。中遇到逆背景问题。

代码:

let calendarEl = document.getElementById(this.element_id);
this.calendar = new FullCalendar.Calendar(calendarEl, {
    plugins: [ 'timeGrid' ],
    height: "auto",
    nowIndicator : true,
    defaultView: 'timeGridDay',
    events: [
        {
            id: 2,
            start: '2019-04-17 10:00:00',
            end: '2019-04-17 11:00:00',
            color: 'blue',
            rendering: 'inverse-background'
        } , {
            id: 2,
            start: '2019-04-17 14:00:00',
            end: '2019-04-17 15:00:00',
            color: 'green',
            rendering: 'inverse-background'
        }
    ]
});
this.calendar.render();

当我使用此代码时,共享相同ID的事件在呈现时不会分组在一起。

1 个答案:

答案 0 :(得分:0)

我不确定,但是我认为您使用的渲染类型错误。

const el = document.querySelector("#calendar");

const calendar = new FullCalendar.Calendar(el, {
  plugins: ['timeGrid'],
  defaultView: 'timeGridWeek',
     events: [
        {
            id: 2,
            start: '2019-04-17 10:00:00',
            end: '2019-04-17 11:00:00',
            color: 'blue',
            rendering: 'inverse-background'
        } , {
            id: 2,
            start: '2019-04-17 14:00:00',
            end: '2019-04-17 15:00:00',
            color: 'blue',
            rendering: 'inverse-background'
        }
    ]
});

calendar.render();

https://codepen.io/anon/pen/rbJyzv