【发布时间】:2020-04-30 17:46:49
【问题描述】:
我正在尝试在日历上显示我的数据。我正在使用完整日历和 Vue js。我正在成功检索数据,我正在使用发出 api 请求的 service.file,它加载数据并将其加载到事件中:''。这是在后端的 Laravel/php 中完成的。如果您需要查看此代码,请告诉我,但它只是将我的采访表中的所有内容返回到 json。当我 console.log() 可以看到数据并尝试将其绑定到 <Fullcalendar /> 组件上,如下所示,但我无法让它显示在日历中。
我做错了什么?
<template>
<div>
<div class="container">
<div class="row justify-content-center">
<div class="col-md-12">
<Fullcalendar :plugins="calendarPlugins" :events="events" />
</div>
</div>
</div>
</div>
</template>
<script>
import Fullcalendar from "@fullcalendar/vue";
import dayGridPlugin from "@fullcalendar/daygrid";
import timeGridPlugin from "@fullcalendar/timegrid";
import interactionPlugin from "@fullcalendar/interaction";
import * as employerInterviewService from '../services/employer_interview_service.js';
export default {
components: {
Fullcalendar
},
data() {
return {
calendarPlugins: [dayGridPlugin, interactionPlugin, timeGridPlugin],
events: "",
};
},
created() {
this.getEvents();
},
methods: {
getEvents: async function() {
const response = await employerInterviewService.loadInterviews();
this.events = response.data.events;
console.log(this.events);
},
},
};
</script>
【问题讨论】:
-
如果您用测试本地数据替换您的数据,它仍然无法工作?
标签: javascript vue.js fullcalendar fullcalendar-4