The Wayback Machine - https://web.archive.org/web/20200920034025/https://github.com/vuejs/vue-router-next/issues/148
Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tag attribute on <router-link> does not seem to be working / a is always used #148

Closed
mika76 opened this issue Mar 29, 2020 · 2 comments
Closed

Comments

@mika76
Copy link

@mika76 mika76 commented Mar 29, 2020

Using router alpha.4 and vue alpha.10

<router-link to="/" tag="li">dashboard</router-link>

gives me (notice the tag attribute in the final html)

<a aria-current="page" href="/#/" tag="li" class="router-link-active router-link-exact-active">dashboard</a>

v-slot not helping either (taken directly from vue router 3 api docs)...

<router-link
  to="/"
  v-slot="{ href, route, navigate, isActive, isExactActive }"
>
  <li
    :class="[isActive && 'router-link-active', isExactActive && 'router-link-exact-active']"
  >
    <a :href="href" @click="navigate">{{ route.fullPath }}</a>
  </li>
</router-link>

I get the following

<a aria-current="page" href="/#/" class="router-link-active router-link-exact-active">
   <li class="router-link-active router-link-exact-active">
      <a href="/#/">/</a>
   </li>
</a>
@posva
Copy link
Member

@posva posva commented Mar 29, 2020

The tag prop isn’t implemented yet as it’s almost always a bad practice because it ends up creating a link on an element that’s isn’t a link, loosing most native features like opening in new tabs and out of the box accessibility so I think this should go through an RFC to gather feedback

The v-slot need a way to detect if a scoped slot is being passed or if it’s a regular one, so it wasn’t done yet but will work

@posva
Copy link
Member

@posva posva commented Apr 1, 2020

Opened vuejs/rfcs#152 to cover this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.
Morty Proxy This is a proxified and sanitized view of the page, visit original site.