fullcalendar / fullcalendar-vue

The official Vue 3 component for FullCalendar
https://fullcalendar.io/docs/vue
MIT License
1.41k stars 88 forks source link

Cannot target calendar api with several instances #155

Closed Msalv-Pentila closed 2 years ago

Msalv-Pentila commented 3 years ago

Hi,

I tried to add 3 different calendars to play a swipe animation but encountered an issue. When I have multiple Fullcalendar instances I can only get the last calendar API.

Given the next three instances :

<FullCalendar
  ref="previous"
  class="calendar"
  :options="calendarOptions"
/>

<FullCalendar
  ref="current"
  class="calendar"
  :options="calendarOptions1"
/>

<FullCalendar
  ref="next"
  class="calendar"
  :options="calendarOptions2"
/>

The next three lines will return the same api (the one for the 'next' instance).

const calendar1 = this.$refs.previous.getApi();
const calendar2 = this.$refs.current.getApi();
const calendar3 = this.$refs.next.getApi();

The bug only appears with fullcalendar/vue3 (not vue2 version) Sand box : https://codesandbox.io/s/fullcalendar-vue3-multiple-instances-forked-1ss6e?file=/src/components/Calendar.vue

acerix commented 3 years ago

Please refer to the support page and use Stack Overflow for help. If this is a bug, please supply a runnable, stripped-down demonstration.

Msalv-Pentila commented 3 years ago

Please refer to the support page and use Stack Overflow for help. If this is a bug, please supply a runnable, stripped-down demonstration.

I've updated the content with a demonstration. Can you check it, please?

acerix commented 3 years ago

Thanks for the demo, it seems like a bug in the Vue component.

swznd commented 3 years ago

any update ?

rmorenohernandez commented 2 years ago

Hi,

is there any fix for this issue? Currently, it is not possible to get the correct fullcalendar instance through getApi() method when using Vue3 and there are multiple instances of FullCalendar components.

Thanks in advance

oliverpaulsen commented 2 years ago

Hi, I have the same issue, does anyone have an idea what causes it? I'm happy to make a PR if someone can point me in the right direction. Thanks

arshaw commented 2 years ago

This is now fixed in v5.11.1. Updated repro

hongquan commented 2 years ago

Hi @arshaw , this fix causes another bug in type inference. Please see my comment in https://github.com/fullcalendar/fullcalendar-vue/commit/49a5a997ea6b7c9d24071b9373fc15a7627165de#r73461685