vue.js - events.push(event) 在全日历中工作,但不在资源时间网格日视图中
问题描述
我希望在选择时间时添加事件。
这在没有资源的 fullcalendar 上运行良好。
但是,当我将 defaultview 更改为“resourceTimeGridDay”时,它不会创建任何事件。我已经添加了 resourceID。当我检查 console.log 但现在显示在日历上时,它会生成 EVENTS 数组
有什么帮助吗?
我正在使用 Vue js。
<template>
<FullCalendar
schedulerLicenseKey="GPL-My-Project-Is-Open-Source"
ref="fullCalendar"
defaultView="resourceTimeGridDay"
:plugins="calendarPlugins"
:config="config"
:events="EVENTS"
:resources="resources"
:selectable="true"
:editable="true"
@select="handleSelect"
/>
</template>
<script>
import FullCalendar from "@fullcalendar/vue";
import { Calendar } from "@fullcalendar/core";
import resourceTimelinePlugin from "@fullcalendar/resource-timeline";
import resourceTimeGridPlugin from "@fullcalendar/resource-timegrid";
import InteractionPlugin from "@fullcalendar/interaction";
import { mapGetters } from "vuex";
export default {
components: {
FullCalendar // make the <FullCalendar> tag available
},
data() {
return {
calendarPlugins: [resourceTimeGridPlugin, InteractionPlugin],
},
resources: [
{ id: "a", title: "Auditorium A" },
{ id: "b", title: "Auditorium B" },
{ id: "c", title: "Auditorium C" }
],
calendarApi: null,
};
},
methods: {
handleSelect(arg) {
var resourceid = arg.resource.id;
this.$store.commit("events/ADD_EVENT", {
title: "test",
start: arg.start,
end: arg.end,
resourceID: resourceid
});
},
},
mounted() {
this.calendarApi = this.$refs.fullCalendar.getApi();
},
computed: {
...mapGetters("events", ["EVENTS"]),
},
};
</script>
<style lang="scss">
@import "~@fullcalendar/core/main.css";
@import "~@fullcalendar/daygrid/main.css";
@import "~@fullcalendar/timeline/main.css";
@import "~@fullcalendar/resource-timeline/main.css";
@import "~@fullcalendar/timegrid/main.css";
</style>
解决方案
推荐阅读
- java - 如何在 Java 中规范化 IPv6 地址?
- python - 使用 Pandas 的函数计算其他两个列
- api - 托管在 localhost 上的 ionic 请求 api 中的 CORS 问题
- powershell - 如何输入字符串列表作为参数?
- python-3.x - 将 Hive SQL 中的 CASE 转换为 Python 3.6 IF else 语句
- asp.net-mvc - 在 Visual Studio 2015 中添加视图时发生错误
- java - Bukkit / Spigotplugin - 从配置中删除条目
- javascript - javascript - Python 的单行列表理解代码的 javascript 版本
- redis - 我如何以扭曲的工厂方法访问redis?
- php - 使用 jquery 动态创建的内容是否对搜索引擎可见?