在fullcalendar.js

时间:2019-01-03 19:13:37

标签: fullcalendar fullcalendar-scheduler

无论我拥有多少资源,我都希望将时间添加到全日历的每个单元格中。

我真的不知道该如何处理。我上传了一张我想要的图片。

非常感谢!

What I have

What I would like

1 个答案:

答案 0 :(得分:0)

找到了! 这个想法是添加后台事件。 “ 15”是您的时隙,在下面的示例中为60分钟

在事件函数中添加(带有任意star_day和end_day)

 events: function(start, end, timezone, callback) {
   var timeCursor = moment(start_day);
   while (timeCursor < moment(end_day))
   {
     events.push({
      start: timeCursor.toISOString(),
      color:"inherit",
      title:timeCursor.utc().format("HH:mm"),
      end: timeCursor.add('15', 'minutes').toISOString(),
      rendering: 'background'
      });
    }
  }

在eventRender函数中添加:

eventRender: function(event, element, view) {
 if (event.rendering == 'background') {
  element.append(event.title);
  }
 }

这是结果(60分钟):

enter image description here