如何将HTML插入fullCalendar 4的事件标题中?

时间:2019-12-13 12:10:16

标签: javascript jquery fullcalendar fullcalendar-4

如何在fullCalendar v4中将HTML插入eventRender中的事件标题中?

document.addEventListener('DOMContentLoaded', function() {
  var calendarEl = document.getElementById('calendar');

  var calendar = new FullCalendar.Calendar(calendarEl, {

    plugins: [ 'interaction', 'dayGrid', 'timeGrid', 'list' ],
    header: {
        left: 'title',
        center: 'dayGridMonth,timeGridWeek,timeGridDay,listMonth',
        right: 'prev,next today'
    },
    navLinks: true, // can click day/week names to navigate views
    businessHours: true, // display business hours
    editable: true,
    locale: 'ru',

    events: [
        {
            title: 'Go Space :)',
            description: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Cras eu pellentesque nibh. In nisl nulla, convallis ac nulla eget, pellentesque pellentesque magna.',
            start: '2019-12-27',
            end: '2019-12-27'
        },
        {
            title: 'Dentist',
            description: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Cras eu pellentesque nibh. In nisl nulla, convallis ac nulla eget, pellentesque pellentesque magna.',
            start: '2019-12-29T11:30:00',
            end: '2019-12-29T012:30:00'
        }
    ],
    eventRender: function(event, element) {

        element.find(".fc-title").append('<strong>bla bla bla</strong>');

    },
  });

  calendar.render();
});

此代码在v3中有效,但在v4中无效。

错误:

  

“无法读取未定义的属性'find'”

0 个答案:

没有答案