2

我正在努力 "@fullcalendar/angular": "^5.5.0",

我无法重新呈现从 API 调用订阅的事件。我到处搜索,但没有任何效果...请帮助..

这是代码:

calendar.component.html

  <full-calendar #calendar [options]="calendarOptions"></full-calendar>

日历组件.ts


  events = [];

  calendarOptions: CalendarOptions = {
    headerToolbar: {
      left: 'prev,next today',
      center: 'title',
      right: 'dayGridMonth,timeGridWeek,timeGridDay,listWeek'
    },
    initialView: 'dayGridMonth',
    initialEvents: this.events, // How to render calendar when events changes???
    weekends: true,
    // events: this.events,
    // lazyFetching: true,
    editable: true,
    selectable: true,
    selectMirror: true,
    dayMaxEvents: true,
    select: this.handleDateSelect.bind(this),
    eventClick: this.handleEventClick.bind(this),
    eventsSet: this.handleEvents.bind(this)

  };

  ngOnInit(): void {
    this._calendarService.onDataChanged.subscribe(res => {
      this.events = res;
    });
}

最终通话:事件发生变化时如何渲染日历???

4

1 回答 1

0

当我使用全日历时,我不是通过选项获取事件,而是像这样:

<full-calendar [events]="calendarEvents">
</full-calendar>

有效。

于 2021-01-08T11:25:34.330 回答