[Vuejs]-Active class binding to all buttons instead of one

0👍

you need to execute the function like firstPhase(); you missed the brackets.

Then again why write 3 functions for that ? Try following:

<button :class="{active: phaseActive.name === 'Phase one'}" v-if="index == 0" /> 
<button :class="{active: phaseActive.name === 'Phase two'}" v-if="index == 1" /> 
<button :class="{active: phaseActive.name === 'Phase three'}" v-if="index == 2" /> 

Its more clear to understand

Leave a comment