If you’re planning to create a variable that can be used throughout your app you can declare a global variable. I’ve described it in another post.
In Vue.js components, you should declare variables in a
data object. Once the Vue.js component is created all the properties found in the data object will be added to Vue’s reactivity system.
If you find this post useful, please let me know in the comments below and subscribe to my newsletter.
Want to share this with your friends?