[Vuejs]-Vuejs counter condition not working when value is reset

0👍

Update your code to

if (x < 0) {
  this.value = 11;
} else if (x > 11) {
  this.value = 0;
} else {
  this.value = x;
}

And it will work 🙂

The reason is that for now when the value is less than 0 it enters the first condition (if (x < 0)) and then it still enters the else so this.value is set to x.

Leave a comment