Accessing rootState in Vuex getter

后端 未结 1 1097
误落风尘
误落风尘 2021-02-11 14:34

How do you access rootState in getters?

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

相关标签:
1条回答
  • 2021-02-11 15:00

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

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