在Vuex getter中访问rootState

sof*_*ode 19 javascript vue.js vuex

你如何进入rootState吸气剂?

const getters = {
  getParams: rootState => {
    return rootState.route.params
  },
}
Run Code Online (Sandbox Code Playgroud)

以上不起作用.这是怎么做到的?

Bil*_*ell 47

如果这个getter在一个模块中rootState是第三个参数.

const getters = {
  getParams: (state, getters, rootState) => {
    return rootState.route.params
  }
}
Run Code Online (Sandbox Code Playgroud)