[Vuejs]-Vue js "store is not defined" in router.js

0👍

So it resolved. It was a Chrome bug saying that store is undefined, it’s in webpack. Store was defined.
The problem was the mismatch between actions and mutations sending payloads that did not match types.

Thanks for all the answers, i appreciate it.

1👍

You need to install it in the main component. Then you refer to this through this.$store. Read the Vuex documentation.

export const store = new Vuex.Store({
  state: {},
  mutations: {},
  getters: {}
})
import store from './store/index'

new Vue({
  store, // <- here
  el: '#app'
})
👤Gander

Leave a comment