CroudTech / vue-fullcalendar

FullCalendar Wrapper for vue
MIT License
483 stars 100 forks source link

Dynamically changing editable and selectable properties #179

Closed Apexal closed 5 years ago

Apexal commented 5 years ago

Thanks for the project!

I use the wrapper on one page in the following way:

<FullCalendar
    ref="calendar"
    :events="totalEvents"
    :editable="editable"
    :selectable="editable"
    :header="calendar.header"
    :config="calendar.config"
/>

editable is a computed property on the component that the calendar is in. The calendar doesn't update the editable or selectable status when the property changes unless the entire calendar is destroyed and rerendered (changing tabs in my case). How can I get it to automatically update?

BrockReece commented 5 years ago

Hey

You should be able to achieve this with a combination of setting options dynamically and this wrapper's fireMethod function

Off the top of my head, something like this should work.

this.$refs.calendar.fireMethod('option', 'editable', true)
Apexal commented 5 years ago

Thanks! The fireMethod option works great!