Adding a store (vuex) later



  • With the Quasar CLI, I originally didn’t add Vuex. Now, I would like to. I used the CLI to create a new store and have done everything according to http://quasar-framework.org/guide/app-vuex-store.html but when I try to access the store via this.$store I get an ‘undefined’ error for store.
    When the store exports “export default store” what is reading this file? Normally, you would do this where Vue instance is created. Am I missing something?


  • Admin

    The CLI checks if you have the store folder and its index.js and reads it. If you want to add it later, just “quasar init” a new project and copy-paste the store folder from it. Obviously, adapt it to your needs.



  • I had the same error, I just had to restart the dev server so it would acknowledge the freshly created store folder.