Open mrin9 opened 6 years ago
I got this bug as well, and for me it seems that AT UI is not only checking for exact route paths, but also similar (like starting with, etc...).
Here's the classes on my Home menu item pointing to /
:
Here are the classes for the same element when I click on another item and the path changes:
The router-link-exact-active
class is dropped, but router-link-active
remains, which led be to the conclusion illustrated at the beginning of this comment.
This is a nice feature, however there should be an option to disable it when needed, which usually includes the home (/
) path.
UPDATE: router-link-exact-active
is provided by vue-router
(see https://router.vuejs.org/api/#exact-active-class), so the logic AT UI uses is definitely faulty here, whatever it's supposed to be doing.
@datitisev Currently dealing with this bug, I tried solving at the AtMenuItem component level. No luck, I'll keep everyone posted and create a PR when done.
The styling also seems to be causing the issue, not the logic itself from what I can see. I went through and completely modified the AtMenuItem to have an exact prop, the styling for active turns on regardless of if the item actually is.
Update: I thought I found the issue, no luck.
See PR https://github.com/AT-UI/at-ui/pull/143/, this might solve your issue. Still in development.
Steps to reproduce
to
prop)Which browser?
All
What is expected?
upon typing a valid path, on browser's url, The menu must remove the previous selected item
What is actually happening?
The previous selected item is not removed
Reproduction Link
Sorry cant create a reproduction link as the use case is tied to browser's url.