[Vuejs]-Stop vue js watch property from watching sub objects

0👍

Just watch what you need:

            watch: {
                'input.country': {
                    handler(newCountry) {

                    }
                }  
            }

0👍

Declare a computed value who target this.item.country:

computed: {
    itemCountry() {
        return this.item.country;
    }
}

And watch this new computed value:

watch: {
    itemCountry: {
        immediate: true,
        handler(newInput) {
            // do your stuff
        }
    }
}

Leave a comment