用computed定义一个address对象吧,然后再去watch addres

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
  }
}
Logo

前往低代码交流专区

更多推荐