使用vuex报错“__WEBPACK_IMPORTED_MODULE_1_vuex__.a.store is not a constructor”

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

Vue.use(Vuex);

const store = new Vuex.store({
    state:{
        num:"我是vuex1"
    }
});
export default store;

控制台显示报错

Uncaught TypeError: __WEBPACK_IMPORTED_MODULE_1_vuex__.a.store is not a constructor

(是因为尝试将不是构造器的对象或者变量来作为构造器使用。)

解决办法:

将new Vuex.store中的“store”大写

new vuex.Store

参考:

http://www.cnblogs.com/yufann/p/Vue-Node10.html

猜你喜欢

转载自www.cnblogs.com/yandeli/p/10860985.html