Is it possible, when button triggers this action, it stays on !this.lastMeasure? Because when I click it again, it goes back to the last state. I want it to stay on the new state.
changeMeasure() {
this.lastMeasure = !this.lastMeasure
}
Vue provides event modifiers for the v-on directive. One of these event modifiers is .once, it rules the associated events to be triggered at most once.
You can use this event modifier like :
<!-- the click event will be triggered at most once -->
<a v-on:click.once="doThis"></a>
Then in your case, you may use something like :
<!-- '@' is the shorthand for 'v-on:' -->
<button @click.once="changeMeasure">I am the button</button>
this.lastMeasure = false