alexusmai / vue-laravel-file-manager

Frontend for Laravel File Manager on Vue.js
MIT License
359 stars 161 forks source link

Vue component not recognizing store: Cannot read property 'commit' of undefined #82

Closed daydevelops closed 3 years ago

daydevelops commented 3 years ago

I am getting this error in my javascript console:

Cannot read property 'commit' of undefined

The $store property on the component seems to be undefined. I have followed the instructions for installation of both the front end package and back end package closely but I cannot see why I am getting this error.

Here is my app.js for my laravel project:

window.Vue = require('vue').default; // I also tried using "import Vue from 'Vue'" like the instructions specify
... 
import Vuex from 'Vuex';
import FileManager from 'laravel-file-manager';
Vue.use(Vuex);
const store = new Vuex.Store();

Vue.use(FileManager, {store});

My config/file-manager.php is the default setup that was given.

I am using laravel's webpack to compile my assets. image image

iwasherefirst2 commented 3 years ago

Does https://github.com/alexusmai/vue-laravel-file-manager/issues/37 help?

daydevelops commented 3 years ago

Yep, adding the store to this part fixed it:

const app = new Vue({
  store,
  el: '#app',
  template: '<example-component></example-component>',
});