1

我正在用 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
    }
}

还有我的模块文件夹中的 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')

有人有什么主意吗?我认为我没有以正确的方式引用“最近”。

4

0 回答 0