vuejs / router

🚦 The official router for Vue.js
https://router.vuejs.org/
MIT License
3.91k stars 1.19k forks source link

Allow link to be in isActive state if the current route name is included in `to-matches` route name array #1933

Closed zakarialounes closed 1 year ago

zakarialounes commented 1 year ago

What problem is this solving

When using an AppBar with VTabs containing links, it is not possible to make the VTab button active for a route other than the one passed in :to. Adding a non-mandatory to-matches array property would make the link active if the named route is included in the to-matches prop.

Proposed solution

Add a to-matches array property for all components actually having a :to prop and update the useLink composable in the router.mjs in order to return true if the route is included in the to-matches property.

Describe alternatives you've considered

Updating the router configuration with all the matches routes for a given route or updating the useLink composable, but actually we can't replace a specific composable.

zakarialounes commented 1 year ago

Sorry, wrong github repository (issue is for vuetify).