While adding the data directly to your Window
object is definitely an option, the most "Vueish" way to do this is to import your data object in main.js
(or equivalent) and create an instance property by adding it to the Vue prototype:
main.js
import global_constants from `./Constants`;
... // Other imports, Vue.use, Vue.component, etc.
Vue.prototype.$global_constants = global_constants; // Adds object to Vue's prototype
new Vue({
... // Create Vue instance with desired config etc.
});
This will make that data accessible by all child components attached to that instance through this.$global_constants
.
The name itself is arbitrary and can be anything you'd like, and the $
at the start is Vue's naming convention for all instance properties.