Categories
javascript vue.js vuejs2

Is there any way to stop triggering vuejs watch methods when the value is changed by the method itself?

watch: {
alert() {
setTimeout(() => {
this.alert = "";
}, 4000);
}
}

Here, alert method is first triggered by the DOM and its triggered again when the value is changed by the method. is there any way to stop repeating?

My goal is here to check if the value of ‘alert’ is changed and if it’s changed, I want to reset the value after 4s and also count how many times it was changed.