小编kat*_*ieh的帖子

必须在创建商店实例之前调用Vue.use(Vuex)

我无法弄清楚为什么我会收到这个错误.一切看起来都很合适.像这样将商店导入组件.

import store from './store';


new Vue({
    components: {
     SomeComponent
    },
    store
});
Run Code Online (Sandbox Code Playgroud)

我的商店看起来像这样

import Vue from 'vue';
import Vuex from 'vuex';

import * as getters from './getters';
import * as actions from './actions';
import mutations from './mutations';

Vue.use(Vuex);

export default new Vuex.Store({
    state: {
       something
    }
})
Run Code Online (Sandbox Code Playgroud)

请帮忙.谢谢

未捕获错误:[vuex]必须在创建商店实例之前调用Vue.use(Vuex).

javascript vuex vuejs2

8
推荐指数
3
解决办法
5851
查看次数

标签 统计

javascript ×1

vuejs2 ×1

vuex ×1