The following code is meant to display several products displayed by brand. when you press the brand\'s button it will display its products. this is working fine however I\'ve a
Try to add another data object property called currentIndex
and update it to the clicked button index :
// DATA
data() {
return {
currentIndex:-1,
isActive: false,
...
inside the template bind the class as follows :class='{buttonActive : (index==currentIndex) }'
:
methods :
changeBrand(index) {
this.object = this.brand[index].products;
this.currentIndex=index;
}