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

feat(router): add NuxtLink support for useLink #19514

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

userquin
Copy link
Member

Description

This PR allows use useLink with NuxtLink, this Nuxt PR should be merged nuxt/nuxt#26522

This will work only when:

To register NuxtLink globally we can use a plugin:

import { NuxtLink } from '#components'

export default defineNuxtPlugin((nuxtApp) => {
  nuxtApp.vueApp.component('NuxtLink', NuxtLink)
})

vuetify-nuxt-module will provide an option to register NuxtLink globally: will allow also to use other name (will register both).

resolves #17490

@userquin
Copy link
Member Author

userquin commented Mar 29, 2024

Right now there is an alternative using custom and default slot props, but requires wrapping the component, for example:

<template>
  <NuxtLink to="/someroute" custom #="{ navigate }">
    <v-btn @click="navigate">Link</v-btn>
  </NuxtLink>
</template>

@KaelWD
Copy link
Member

KaelWD commented Mar 30, 2024

Router-link is available in nuxt right? How does using this instead behave differently?

@userquin
Copy link
Member Author

Router-link is available in nuxt right? How does using this instead behave differently?

Both are there, this PR should be changed to allow render RouterLink and NuxtLink (v2 behavior): https://nuxt.com/docs/api/components/nuxt-link

The linked issue explains the behavior...

@userquin userquin marked this pull request as draft March 30, 2024 11:57
@userquin
Copy link
Member Author

Sorry for the confusion:

This PR was about adding NuxtLink:useLink support from Nuxt issue (the releated issue here was mentioned there, but it is not related): Nuxt issue is about adding useLink, Vuetify issue is about rendering RouterLink and/or NuxtLink.

@KaelWD
Copy link
Member

KaelWD commented Apr 19, 2024

That doesn't really answer my question. NuxtLink supports internal and external links but we already have that with to/href. Afaict the only other difference is prefetching but you haven't implemented that in useLink.

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

Successfully merging this pull request may close these issues.

[Feature Request] Support nuxt prop for Vuetify 3 on Routable components
3 participants