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)
})
posted @ 2021-10-02 16:18  胸怀丶若谷  阅读(1646)  评论(0编辑  收藏  举报