我正在用来自URL的JSON在Angular上提供我的Fullcalendar示例。
GET返回200,其中包含格式良好的JSON数据,但日历中没有显示任何事件。
下面是我的日历选项:
calendarOptions: CalendarOptions = {
initialView: 'dayGridMonth',
plugins: [interactionPlugin,
dayGridPlugin,
timeGridPlugin,
listPlugin,],
editable: true,
selectable: true,
select: this.handleDateSelect.bind(this),
eventClick: this.handleEventClick.bind(this),
eventsSet: this.handleEvents.bind(this),
events: 'http://127.0.0.1:8097/event',
startParam: 'startTime',
endParam: 'endTime',
timeZoneParam: 'local'
};
控制台上没有错误,只是月视图中没有事件。
下面是GET API调用的JSON响应:
[
{"id":1510,"description":null,"doctorId":1,"endTime":"2021-01-09T16:15","healthServiceId":3,"isEventDone":false,"isRecurring":false,"patientId":null,"patientName":null,"patientSurname":null,"phoneNumber":"338-3248104","startTime":"2021-01-09T16:00"},
{"id":1512,"description":null,"doctorId":1,"endTime":"2021-01-09T16:45","healthServiceId":1,"isEventDone":false,"isRecurring":false,"patientId":467,"patientName":null,"patientSurname":null,"phoneNumber":"329-9590677","startTime":"2021-01-09T16:15"},
{"id":1513,"description":null,"doctorId":1,"endTime":"2021-01-09T17:00","healthServiceId":2,"isEventDone":false,"isRecurring":false,"patientId":748,"patientName":null,"patientSurname":null,"phoneNumber":"327-4571259","startTime":"2021-01-09T16:45"},
{"id":1514,"description":null,"doctorId":1,"endTime":"2021-01-09T17:15","healthServiceId":2,"isEventDone":false,"isRecurring":false,"patientId":592,"patientName":null,"patientSurname":null,"phoneNumber":"348-1588967","startTime":"2021-01-09T17:00"},
{"id":1515,"description":null,"doctorId":1,"endTime":"2021-01-09T16:00","healthServiceId":32,"isEventDone":false,"isRecurring":false,"patientId":112,"patientName":null,"patientSurname":null,"phoneNumber":"338-5994091","startTime":"2021-01-09T15:45"},
{"id":1516,"description":null,"doctorId":1,"endTime":"2021-01-09T17:30","healthServiceId":2,"isEventDone":false,"isRecurring":false,"patientId":423,"patientName":null,"patientSurname":null,"phoneNumber":"389-4895518","startTime":"2021-01-09T17:15"},
{"id":1517,"description":null,"doctorId":1,"endTime":"2021-01-09T17:45","healthServiceId":7,"isEventDone":false,"isRecurring":false,"patientId":60,"patientName":null,"patientSurname":null,"phoneNumber":"380-4559938","startTime":"2021-01-09T17:30"},
{"id":1518,"description":null,"doctorId":1,"endTime":"2021-01-09T15:45","healthServiceId":3,"isEventDone":false,"isRecurring":false,"patientId":829,"patientName":null,"patientSurname":null,"phoneNumber":"349-8027366","startTime":"2021-01-09T15:30"},
{"id":1519,"description":null,"doctorId":1,"endTime":"2021-01-09T15:30","healthServiceId":32,"isEventDone":false,"isRecurring":false,"patientId":129,"patientName":null,"patientSurname":null,"phoneNumber":"349-3404658","startTime":"2021-01-09T15:20"},
{"id":1520,"description":null,"doctorId":1,"endTime":"2021-01-09T18:10","healthServiceId":1,"isEventDone":false,"isRecurring":false,"patientId":null,"patientName":null,"patientSurname":null,"phoneNumber":"0873-547325","startTime":"2021-01-09T17:45"},
{"id":1521,"description":null,"doctorId":1,"endTime":"2021-01-09T18:30","healthServiceId":2,"isEventDone":false,"isRecurring":false,"patientId":716,"patientName":null,"patientSurname":null,"phoneNumber":"328-4331424","startTime":"2021-01-09T18:10"}
]
1条答案
按热度按时间c9x0cxw01#
根据fullcalendar的event parsing documentation,您放入事件数据中的日期必须位于名为
start
和end
的属性中。您已经将它们放在
startTime
和endTime
中-这是无效的,除非它是recurring event。