[Vuejs]-With VueJS Cli how should do to have a variable common to all pages and be able to watch it in a page

0👍

Component based UI frameworks like Vue, React, and friends enforce the idea of passing data down into components (Props in Vue) but not allowing those components to pass updates to that data up to parents by simply changing the data. The reason for this is performance; making data changes explicitly allows the framework to only re-render when it needs to.

Instead of updating props that have been passed into a component, updates can be passed up with events or by using a state manager like Vuex.

If you’re looking for a simple way to achieve this, check out $.emit : https://v2.vuejs.org/v2/api/#vm-emit

Leave a comment