我正在努力
"@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;
});
}
最终通话:事件发生变化时如何渲染日历???