router icon indicating copy to clipboard operation
router copied to clipboard

RouterLink isActive slot not true when it should be

Open codecat opened this issue 3 years ago • 2 comments
trafficstars

Version

4.1.5

Reproduction link

jsfiddle.net/16nudxt0/

Steps to reproduce

In the jsfiddle, click on "bar".

What is expected?

I would expect the bool values after "foo" to show "true, false", because /foo/bar should indicate that /foo is active (but not exact).

What is actually happening?

The "foo" link says isActive is false.

codecat avatar Sep 14 '22 01:09 codecat

This is intended. See https://router.vuejs.org/guide/migration/index.html#removal-of-the-exact-prop-in-router-link

I think this could be added somewhere else on docs. Maybe when we talk about active class or maybe in extending router link section

posva avatar Sep 14 '22 07:09 posva

Ah, I missed that in the migration guide. If I read the RFC correctly, to get this behavior like it was in Vue Router 3, I would have to check manually if the current URL starts with the path of the router link?

codecat avatar Sep 14 '22 10:09 codecat