在FullCalendar v4中显示自定义字段

时间:2019-05-30 19:03:01

标签: custom-events fullcalendar-4

我正在尝试实现FullCalendar v4,以显示事件,而不仅仅是事件列表中给出的标题。我发现了很多不同的建议,但是没有一个对我有用。

我有以下有效的代码,但无法添加要通过renderEvent函数显示的描述。解决方案是什么?

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

var mDate = new Date();
var CurrentDate = (mDate.getFullYear().toString()) + '-' + (String(mDate.getMonth() + 1).padStart(2, '0')) + '-' + (String(mDate.getDate()).padStart(2, '0'));

var calendar = new FullCalendar.Calendar(calendarEl, {
  plugins: [ 'interaction', 'timeGrid', 'dayGrid' ],
  defaultDate: CurrentDate,
  header: {
    left: 'prev,next today',
    center: 'title',
    right: ''
  },
  defaultView: 'timeGridWeek',
  nowIndicator: true,
  locale: 'hu',
  firstDay: 1,
  editable: true,
  selectable: true,
  eventLimit: true, // allow "more" link when too many events
  select: function(arg) {
    var title = prompt('Event Title:');
    if (title) {
      calendar.addEvent({
        title: title,
        start: arg.start,
        end: arg.end,
        allDay: arg.allDay
      })
    }
    calendar.unselect()
  },
  eventRender: function( info ) {

  },
  events: [
    {
      title: 'Próba' ,
      start: '2019-05-30',
      end: '2019-05-31',
      description: 'description'
    }
  ]
});

calendar.render();

});

0 个答案:

没有答案