Skip to content Skip to sidebar Skip to footer

Vue - Calling Store Getter After Dispatch Completes?

I'm using Laravel 5.7 + Vue2 + Vuex I am having some difficulty getting Vue to return a store value after my dispatch call completes. My application flow looks like this: I click

Solution 1:

You're losing the scope of this (Vue instance) inside your callback, to fix that use arrow function ()=> like :

    methods: {
     validate()
       {
       this.$store.dispatch('addLease', this.input).then(()=> {
        console.log(this.leaseStore);
      });
     }
   }

Post a Comment for "Vue - Calling Store Getter After Dispatch Completes?"