Posts

Showing posts with the label vuex

Vuex unknown local mutation type, 'moduleName', global type: 'moduleName/moduleName'

Image
Clash Royale CLAN TAG #URR8PPP Vuex unknown local mutation type, 'moduleName', global type: 'moduleName/moduleName' I'm using Vuex in my Vue.js project. Error message is the same, as the title: Vuex unknown local mutation type, 'moduleName', global type: 'moduleName/moduleName' All of my views(components) are displayed via <router-view></router-view> and I want to dispatch an action when entering a specific route. <router-view></router-view> So, my App.vue looks like this: <template> <div id="app" class="wrapper"> <router-view></router-view> </div> </template> I tried: Importing the store to avoid using this.$store.dispatch. So it looked like this /components/myComponent import store from '../store' ... beforeRouteEnter (to, from, next) { next(vm => { store.dispatch('moduleName/actionName', payload) }) } This didn't work....