Vuex External File
Setup Vuex with external file https://vuex.vuejs.org/installation.html
But after this make a file in the resources/assets/js called store.js then set it up as needed Here I will have one loading state
export default {
state: {
loading: true,
},
getters: {
loading: state => {
return state.loading;
},
},
mutations: {
loading(state, loading) {
state.loading = loading;
}
}
};
now import it into your app.js
import store from './store';
and