Home

Issue: 3185

vuex initialization inside of a module does not provide this.app context

[issue link]

What problem does this feature solve?

Developing a module currently does not work as expected if users would require the initialization of Vuex:

export default (ctx) => {
  const {app, store} = ctx
  const storeOptions = {
    state: Object.assign(general.state, apollo.state, content.state),
    getters: Object.assign(general.getters, apollo.getters, content.getters),
    mutations: Object.assign(general.mutations, apollo.mutations, content.mutations),
    actions: Object.assign(general.actions, apollo.actions, content.actions)
  }
 store.registerModule('lc', Object.assign({}, storeOptions))
}
getters:{
  test(state){
    console.log(this.app) //=> this.app is 'undefined'.
  }
}

What does the proposed changes look like?

It would be great if Vuex inside of a module would automatically receive the this.app context. Also all through a module/plugin injected context variables would be great to be available

This feature request is available on Nuxt.js community (#c6835)