Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

router-link-active class is removed if the route is not exact #2707

Closed
madmoizo opened this issue Apr 11, 2019 · 6 comments
Closed

router-link-active class is removed if the route is not exact #2707

madmoizo opened this issue Apr 11, 2019 · 6 comments

Comments

@madmoizo
Copy link

madmoizo commented Apr 11, 2019

Version

3.0.3

Reproduction link

https://codesandbox.io/embed/zrjv12l0rp

Steps to reproduce

  • Click on Home
  • Click on Nested 2

What is expected?

Home should have router-link-active class

What is actually happening?

router-link-active is removed from Home on route change

@posva
Copy link
Member

posva commented Apr 11, 2019

this is working as expected, the exact prop is what adds that behaviour

@posva posva closed this as completed Apr 11, 2019
@madmoizo
Copy link
Author

madmoizo commented Apr 11, 2019

@posva the repro was wrong, I fixed it, the issue is a bit more complex.
It seems related to redirect

@madmoizo
Copy link
Author

@posva may you give it an other try ?

@posva
Copy link
Member

posva commented Apr 12, 2019

Do the redirect in a child instead, that makes more sense 🙂

children: [
        {
          path: "home",
          name: "home",
          component: HomePage,
          children: [
            { path: '',  redirect: {
              name: "page-1"
            }},
            {
              path: "page-1",
              name: "page-1",
              component: Page1
            },
            {
              path: "page-2",
              name: "page-2",
              component: Page2
            }
          ]
        }
      ]

@madmoizo
Copy link
Author

madmoizo commented Apr 12, 2019

It means router-link-active works only in some cases since v3.0.3 and it's expected ?

@madmoizo
Copy link
Author

madmoizo commented Apr 25, 2019

Glad to see that an issue is considered an issue after 3 reports #2724

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants