fullcalendar.js 715 B

123456789101112131415161718192021222324
  1. import { loadResource } from "../../static/utils/resources.js";
  2. export default {
  3. template: "<div></div>",
  4. props: {
  5. options: Array,
  6. resource_path: String,
  7. },
  8. async mounted() {
  9. await this.$nextTick(); // NOTE: wait for window.path_prefix to be set
  10. await loadResource(window.path_prefix + `${this.resource_path}/index.global.min.js`);
  11. this.options.eventClick = (info) => this.$emit("click", { info });
  12. this.calendar = new FullCalendar.Calendar(this.$el, this.options);
  13. this.calendar.render();
  14. },
  15. methods: {
  16. update_calendar() {
  17. if (this.calendar) {
  18. this.calendar.setOption("events", this.options.events);
  19. this.calendar.render();
  20. }
  21. },
  22. },
  23. };