我正在用vue-native构建移动本机应用程序,但遇到了问题。我想检索商店中某物的状态,但似乎找不到该商店。 这是我的代码:
import {mapGetters, mapActions} from 'vuex'
import Store from '../../store/Index'
computed: {
...mapGetters('dashboard', ['recent'])
},
我的信息中心文件夹中的我的Index.js:
import actions from './Actions'
import getters from './Getters'
import mutations from './Mutations'
export default function () {
return {
namespaced: true,
state: {
recent: {
data: [],
},
visited: {
data: [],
pagination: null
},
own: {
data: [],
pagination: null
}
},
actions,
getters,
mutations
}
}
还有我的Modules文件夹中的Index.js:
import Vue from "vue-native-core";
import Vuex from "vuex";
import user from './modules/user/Index'
import dashboard from './modules/dashboard/Index'
import communities from'./modules/communities/Index'
import settings from './modules/settings/Index'
import search from './modules/search/Index'
Vue.use(Vuex);
const store = new Vuex.Store({
modules: {
user: user(),
dashboard: dashboard(),
communities: communities(),
settings: settings(),
search: search(),
},
});
export default store;
我不断收到此错误;
TypeError: undefined is not an object (evaluating 'store._modulesNamespaceMap')
有人知道吗?我认为我计算出的方法不是正确的“最近”。