Vuex: Access State From Another Module

后端 未结 6 783
走了就别回头了
走了就别回头了 2021-01-30 08:12

I want to access state.session in instance.js from records_view.js. How is this accomplished?

store/modules/instance.js

6条回答
  •  花落未央
    2021-01-30 08:36

    You need to define session in your state like following, to access it in your getters:

    const state = {
      session: ''
    }
    

    You have to write a mutation, which will be called from your actions to set this state value.

提交回复
热议问题