vuex__WEBPACK_IMPORTED_MODULE_1__.default.store is not a constructor
第一个错误是很多人遇到过的,细节问题,在main.js里new Vuex的时候,store要大写S
//错误写法
const store =new Vuex.store({
})
//正确写法
const store =new Vuex.Store({
})
第二个错误:
Property or method "$store" is not defined on the instance but referenced during render.
我是vue2,那么应该对应下载vuex3的版本,vue3对应vuex4,所以重新安装一下vuex就解决问题了:
npm i vuex@3 --S
或
yarn add vuex@3 --S