[Vuejs]-How to use a global variable in vue, it does not update computed variables?

0👍

Use watch instead of a computed property.

watch:{
  '$userData' = function(newValue){
     ...
     this.name = newValue.name;
     ...
  }
}

Get more info at: https://flaviocopes.com/vue-watchers/

PS: assuming, you can access $userData throughout the Vue application.

Leave a comment