VueX报错:Cannot read property 'commit' of undefined

原因

main.js文件中没有引入store

解决方案

image
添加如下代码即可

import store from "./store";
new Vue({
  el: '#app',
  router,
  store,
  render: h => h(App)
})
博观而约取,厚积而薄发
原文地址:https://www.cnblogs.com/leoych/p/15362113.html