Sometimes, we want to apply global variables to Vue.js.
In this article, we’ll look at how to apply global variables to Vue.js.
How to apply global variables to Vue.js?
To apply global variables to Vue.js, we can add our global variables into the Vue
prototype.
For instance, we write
Vue.prototype.$appName = 'App'
to add the $appName
global variable that we can access in all components in the app with
this.$appName
Conclusion
To apply global variables to Vue.js, we can add our global variables into the Vue
prototype.