我正在尝试从另一个模块中的getter内部的另一个命名空间vuex模式访问状态,这是我正在尝试的:
//GETTERS
const getters = {
authorizedAdminLinks: ({ rootState }) => _.filter(rootState.globals.adminLinks, link => link.seePrivilege >= rootState.globals.auth.privileges),
}
我遇到以下错误:
[Vue warn]: Error in render: "TypeError: rootState is undefined"
答案 0 :(得分:0)
在模块中定义时,获取器将rootState
作为a third argument接收:
const getters = {
authorizedAdminLinks: (state, getters, rootState) => _.filter(rootState.globals.adminLinks, link => link.seePrivilege >= rootState.globals.auth.privileges),
}