[Vuejs]-Getting data from independent child component to other components with router

0👍

It’s OK to use a global store as you are doing, the docs even have a guide on how to do so: https://v2.vuejs.org/v2/guide/state-management.html#Simple-State-Management-from-Scratch

If you want a more structured way of doing this, look into Vuex, which is also written by the Vue team: https://vuex.vuejs.org/

Vuex integrates nicely into the Vue devtools and sidesteps the import/passing problems you’re describing (because it is a plugin injected via Vue.use, then $store is available in every Vue)

👤Matt

Leave a comment