[Vuejs]-Update Full calendar Vue events with data from API after an input outside the calendar

3👍

one of the ways to update a component is to give it a key:

<template>
  <FullCalendar :key="calendarKey" :options="calendarOptions"/>
</template>

and after you receive the events, change the key (I use nanoid package to generate IDs):

<script>
  ...
  async getEventsForBuilding(building) {
    try {
      this.calendarOptions.events = data;
      this.calendarKey = nanoid(20);
    } catch (error) {
    ...
  },
  ...
</script>

Leave a comment