1π
β
Yes, there is a benefit β when you use the options
object you can also add Vue-Router, Vuex, define some data, computed properties, watchers, methods and even some lifecycle hooks. For example:
new Vue({
data:
{
currentUser: null,
lastError: null,
showLoadingSpinner: false,
},
computed:
{
baseURL()
{
return process.env.BASE_URL;
}
},
created()
{
this.$on('logout', this.logout);
},
beforeDestroy()
{
this.$off('logout', this.logout);
},
router: myRouter,
store: myStore,
render: h => h(App),
}).$mount('#app');
Source:stackexchange.com