DEV Community

PCes83
PCes83

Posted on

[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)