将事件从对象VUE添加到完整日历



我试图在vue分配一个事件对象的事件,但它没有显示给我,我做错了什么?数据在控制台中正确显示,但没有出现在日历中。

import axios from "axios";
import "@fullcalendar/core/vdom";
import FullCalendar from "@fullcalendar/vue3";
import dayGridPlugin from "@fullcalendar/daygrid";
import interactionPlugin from "@fullcalendar/interaction";
export default {
name: "calendar",
components: {
FullCalendar,
},
data() {
return {
allevents: [],
calendarOptions: {
plugins: [dayGridPlugin, interactionPlugin],
initialView: "dayGridMonth",
dateClick: this.handleDateClick,
events: this.allevents,
},
};
},
mounted() {
axios
.get("url_json")
.then((response) => {
this.listDataString = JSON.stringify(response.data, null, "t");
this.allevents = response.data.result.map(eventnew => ({title: eventnew.subject, start: eventnew.start.dateTime, end: eventnew.end.dateTime, allDay: 'true'}));
console.log(this.allevents);
return response;
});
},
};

解决方案是在挂载的this.calendarOptions.events = response.data.result.map(eventnew => ({title: eventnew.subject, start: eventnew.start.dateTime, end: eventnew.end.dateTime, allDay: 'true'}));中分配事件

最新更新