DEV Community

PCes83
PCes83

Posted on

1 1

[vue-router] Active route, subpath

Hi all,

I have the following routes:

{ path: '/offers/',                 component: OfferList,           name: 'offerList' },
{ path: '/offers/:id',              component: OfferView,           name: 'offerView'}

Enter fullscreen mode Exit fullscreen mode

And the following link:

<router-link :to="{ name: 'offerList'}" custom v-slot="{ navigate, href, isActive, isExactActive  }">
      <li class="menu-item" :class="{ 'active': isActive }">
        <a :href="href" class='menu-link'><span>Offres partenaires</span></a>
      </li>
    </router-link>

Enter fullscreen mode Exit fullscreen mode

According to the documentation, when I load the offerView url, the router-link should have isActive == true but it doesn't

Can you tel me what's wrong with that ?

Thanks

Top comments (0)

Billboard image

Create up to 10 Postgres Databases on Neon's free plan.

If you're starting a new project, Neon has got your databases covered. No credit cards. No trials. No getting in your way.

Try Neon for Free →

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay