CroudTech / vue-fullcalendar

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

Using vuex store as eventSources #148

Closed stephiescastle closed 6 years ago

stephiescastle commented 6 years ago

Hi, I'm fairly new to Vue, and I'm specifically using full calendar in Nuxt.

I'm wondering if it's possible to use vuex store objects as eventSources. I got it working just using :event="myStore" but I would like to use multiple store objects. So, for instance:

       eventSources: [
          myStore,
          myStore2,
          myStore3
        ],

Is this possible? BTW, I am using Vuex store in Modules Mode.

BrockReece commented 6 years ago

If i have understood correctly, each source will be an array of event objects that is stored in Vuex? That should work, I don't see any reason why it wouldn't. Let me know how you get on.

stephiescastle commented 6 years ago

Ah, yes. It worked. It wasn't working before because I was pulling in my store objects using modules mode:

    computed: {
      testdata () { return this.$store.state.testdata.list }
    }

and trying to set eventSources as a data property. This didn't work because computed props aren't assignable to data props. To get this to work, I had to declare it inline:

<full-calendar ref="calendar" :event-sources="[testdata]" :config="config" />