-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfullcalendar.js
More file actions
35 lines (34 loc) · 1.12 KB
/
fullcalendar.js
File metadata and controls
35 lines (34 loc) · 1.12 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
import { loadResource } from "../../static/utils/resources.js";
export default {
template: "<div></div>",
props: {
options: Array,
custom_css: String,
resourcePath: String,
},
async mounted() {
// wait for window.path_prefix to be set
await this.$nextTick();
await loadResource(window.path_prefix + `${this.resourcePath}/index.global.min.js`);
this.options.eventClick = (info) => this.$emit("click", { info });
// see: https://fullcalendar.io/docs/datesSet
this.options.datesSet = (info) => this.$emit("change", { info });
this.calendar = new FullCalendar.Calendar(this.$el, this.options);
this.calendar.render();
},
methods: {
update_calendar() {
if (this.calendar) {
// set events for JS calendar with data from Python
this.calendar.setOption("events", this.options.events);
// apply custom css if provided
if (this.custom_css) {
const style = document.createElement('style');
style.innerHTML = this.custom_css;
document.head.appendChild(style);
}
this.calendar.render();
}
},
},
};