[Vuejs]-Vue not updating input that depends on another

0👍

You should define your customer object like so customer:

{
    country: null, // or some other default value
    countryCode: null,
}, 

You can find more details in the documentation here

0👍

This is how you shoul do it or @Nora’s method of initializing the object properties to null

 updateCountryCode: function(country) {
   this.$set(this.customer, 'countryCode', country.code) 
}, 

And the reason is because of change detection caveats in vue reactivity

Leave a comment