Accessing rootState in Vuex getter

后端 未结 1 1182
醉话见心
醉话见心 2021-02-11 13:58

How do you access rootState in getters?

const getters = {
  getParams: rootState => {
    return rootState.route.params
  },
}

相关标签:
1条回答
  • 2021-02-11 14:53

    If this getter is in a module rootState is the third arguments.

    const getters = {
      getParams: (state, getters, rootState) => {
        return rootState.route.params
      }
    }
    
    0 讨论(0)
提交回复
热议问题