Skip to content

isActive not working as expected with v-slot API #207

@jakedohm

Description

@jakedohm

Reproduction

https://github.com/jakedohm/router-link-slot-bug-reproduction

Expectation

When I use the v-slot API on a router-link, I'm able to use the isActive property to set classes on the link, like so:

<router-link
  v-slot="{ isActive }"
  :class="[isActive ? 'bg-red' : 'bg-blue']"
  active-class="underline"
  to="/"
  >Home</router-link
>

What's really happening

The isActive property doesn't appear to be set on initial render, causing the bg-blue class to always be set, even if that link is active. Vue throws this warning:
Screenshot 2020-05-01 09 06 10

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions