Just beginning with Vue soooo...be gentle with me! :) Situation: I have 2 different buttons which I would like to set/unset an active class on another element, 1 button sets the class and the other should remove the active class. I'm struggling with the method side (i think...). Code is from VueStoreFront.
<SfButton
class="sf-button--text navbar__grid-view"
@click="listView = false"
>
<SfIcon size="32px" color="#BEBFC4" icon="tiles" />
</SfButton>
<SfButton
class="sf-button--text navbar__list-view"
@click="listView = true"
>
<SfIcon size="32px" color="#BEBFC4" icon="list" />
</SfButton>
The element where the class should be set and removed
<div :class="'products ' + (listView ? 'active' : '')" >Lorem Ipsum</div>
Then in methods i have
methods: {
listView(){
this.active=false
},
Can anyone put me in the right direction? Thanks in advance!