Monitor change in the value 2, after performing the method

data() {
  return {
    city: '',
    country: ''
  }
},
computed: {
  address() {
    const { city, country } = this
    return {
      city,
      country
    }
  }
},
watch: {
  address: {
    handler: function(newval , oldval) {
      console.log('address new =:' + newval );
      console.log('address old =:' + oldval );
    },
    deep: true
  }

 

Guess you like

Origin www.cnblogs.com/taochengyong/p/11082347.html