You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Use vue-router version 3.0.6. Create a parent route with 2 child routes:
/parent
/parent/child-1
/parent/child-2
Add a redirect function to the parent route that will automatically redirect to child-1.
Create a router link for all 3 routes.
Observe that when the URL is /parent/child-1 the router link to /parent has the active route css class.
Observe that when the URL is /parent/child-2 the router link to /parent does NOT have the active route css class.
In version 3.0.2 the route active class will still be on the /parent router link when the URL is /parent/child-2.
A redirect with a component doesn't make sense, you should use an empty child with a redirect instead but then you will find this issue: #2724
I'm closing this as a duplicate of that
Version
3.0.2
Reproduction link
https://codepen.io/autumnwoodberry/pen/jovEqW?editors=1010
Steps to reproduce
Use vue-router version
3.0.6
. Create a parent route with 2 child routes:Add a
redirect
function to the parent route that will automatically redirect tochild-1
.Create a router link for all 3 routes.
Observe that when the URL is
/parent/child-1
the router link to/parent
has the active route css class.Observe that when the URL is
/parent/child-2
the router link to/parent
does NOT have the active route css class.In version 3.0.2 the route active class will still be on the
/parent
router link when the URL is/parent/child-2
.Here is the working version example: https://codepen.io/autumnwoodberry/pen/jovEqW?editors=1010
And here is the non-working version example: https://codepen.io/autumnwoodberry/pen/yWxyYJ
What is expected?
Route active class should be present on a link to a parent route when the child route is active.
What is actually happening?
The route active class is not present.
The text was updated successfully, but these errors were encountered: