Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

147
Vistas
How to use FullCalendar with vuex

I would like to use FullCalendar and keep the events in the vuex store. I have the store set up for the events, I have getters, mutations and an action to call the api and populate the store.

// index.js of the store

export default createStore({
    state () {
      return {
        events: [],
      }
    },
    getters: {
      events: state => state.events,
    },
    mutations: {
      setEvents (state, events) {
          state.events = events
    },
    actions: {
      fetchEvents({ commit }, fetchInfo) {
          const result = // ... API call
          commit('setEvents', result)
      }
    }
  }
})
// calendar.vue

<template>
    <FullCalendar ref="fullCalendar" :options="configOptions"/>
</template>

<script>
// ... omitted imports

export default {
    components: {
    Calendar,
    FullCalendar,
    },
  computed: {
    ...mapGetters(['events']),
    configOptions () {
      return {
        // ... omitted config
        events: this.events,
        datesSet: this.handleViewChange
      }
    },
  },
  methods: {
    ...mapActions({fetchEvents: 'fetchEvents'}),
    handleViewChange(args) {
        // ... omitted handling of dates
        this.fetchEvents(request)
    },
  }
}
</script>

Now I want to fetch new events every time the view changes. I have tried to use datesSet, which is supposed to be called every time the bounding dates of the view change (something that doesn't happen in my code), but unfortunately it's also called when the events in the store change. Meaning datesSet keeps calling the fetch action over and over every times it's finished rendering what just got returned from the fetch.

I have also tried viewClassNames, same result.

Can someone point me in the right direction?

about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda