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

喜欢ヅ旅行 2021-12-07 14:59 981阅读 0赞
  1. import Vue from 'vue';
  2. import Vuex from 'vuex';
  3. Vue.use(Vuex);
  4. const store = new Vuex.store({
  5. state:{
  6. num:"我是vuex1"
  7. }
  8. });
  9. 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

转载于:https://www.cnblogs.com/yandeli/p/10860985.html

发表评论

表情:
评论列表 (有 0 条评论,981人围观)

还没有评论,来说两句吧...

相关阅读