Vue:Uncaught TypeError Object(...) is not a function at resetStoreState (vuex.esm-browser.js55021

简介: Vue:Uncaught TypeError Object(...) is not a function at resetStoreState (vuex.esm-browser.js55021

原因:Vue 2.x和Vuex 4.x版本不对应


Vue 3 匹配Vuex 4 ,Vue 2 匹配Vuex 3


问题


浏览器控制台报错


Uncaught TypeError: Object(…) is not a function
at resetStoreState (vuex.esm-browser.js5502:140:1)
at new Store (vuex.esm-browser.js5502:932:1)
at eval (index.js4360:48:1)
at Module…/src/store/index.js (index.js:1115:1)
at __webpack_require__ (index.js:849:30)
at fn (index.js:151:20)
at eval (main.js:13:64)
at Module…/src/main.js (index.js:1103:1)
at __webpack_require__ (index.js:849:30)
at fn (index.js:151:20)


vuex源码报错


google浏览器源代码


store._state = reactive({
  data: state
});



解决


npm先卸载Vuex 4.xx


npm uninstall vuex --save


安装Vuex 3.xx


npm install vuex@3 --save
相关文章
|
10月前
|
设计模式 JavaScript 前端开发
js中new和object.creat区别
【10月更文挑战第29天】`new` 关键字和 `Object.create()` 方法在创建对象的方式、原型链继承、属性初始化以及适用场景等方面都存在差异。在实际开发中,需要根据具体的需求和设计模式来选择合适的方法来创建对象。
|
存储 JavaScript 前端开发
JS篇(Array、Object)
JS篇(Array、Object)
138 1
|
JavaScript 前端开发 开发者
Vue.js 响应式变革来袭!结合热点技术,探索从 Object.defineProperty 到 Proxy 的奇妙之旅,触动你的心
【8月更文挑战第30天】在 Vue.js 中,响应式系统自动追踪并更新数据变化,极大提升了开发体验。早期通过 `Object.defineProperty` 实现,但存在对新旧属性处理及数组操作的局限。Vue 3.0 引入了 `Proxy`,克服了上述限制,提供了更强大的功能和更好的性能。实践中,可根据项目需求选择合适的技术方案,并优化数据操作,利用懒加载等方式提升性能。
119 0
|
存储 JSON JavaScript
【Python】已完美解决:TypeError: the JSON object must be str, bytes or bytearray, not dict
【Python】已完美解决:TypeError: the JSON object must be str, bytes or bytearray, not dict
647 1
|
前端开发
Error in created hook: “TypeError: _test.default is not a function
Error in created hook: “TypeError: _test.default is not a function
Crypto-JS——Uncaught Error: Malformed UTF-8 data
Crypto-JS——Uncaught Error: Malformed UTF-8 data
1061 0
|
JSON 前端开发 数据格式
【Python】已解决:TypeError: Object of type JpegImageFile is not JSON serializable
【Python】已解决:TypeError: Object of type JpegImageFile is not JSON serializable
276 0
|
开发者 Python
【Python】已解决:TypeError: descriptor ‘index‘ for ‘list‘ objects doesn‘t apply to a ‘str‘ object
【Python】已解决:TypeError: descriptor ‘index‘ for ‘list‘ objects doesn‘t apply to a ‘str‘ object
352 0
|
开发者 Python
【Python】已解决:TypeError: a bytes-like object is required, not ‘int’
【Python】已解决:TypeError: a bytes-like object is required, not ‘int’
850 0
|
JSON JavaScript API
JS【详解】Map (含Map 和 Object 的区别,Map 的常用 API,Map与Object 的性能对比,Map 的应用场景和不适合的使用场景)
JS【详解】Map (含Map 和 Object 的区别,Map 的常用 API,Map与Object 的性能对比,Map 的应用场景和不适合的使用场景)
700 0

热门文章

最新文章