I'm writing a CRUD app using Vue with Vuetify. I have some links defined as v-btns using the "to" attribute. I've noticed that when clicking on buttons, the active button usually changes so that the button corresponding to the user's current location is highlighted. However, I have two routes that look like this:
"/songs/new"
"/songs"
The v-btn's have the following "to" attributes:
to:"/songs/new"
to:"/songs"
However, when clicking on the button that directs to "/songs/new", vuetify sets both buttons to be active. Any idea why it does this?
You need to make use of exact attribute.
<v-btn to="/songs/new" exact>Songs</v-btn>
<v-btn to="/songs" exact>New Song</v-btn>
Now the button will get active class only if you were in exactly route.
Also you can make use of exact-active-class to use custom active classes.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With