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: add useLink
to NuxtLink
#26522
Conversation
Run & review this pull request in StackBlitz Codeflow. |
We need to move the second test to some fixture |
@@ -207,43 +280,11 @@ export function defineNuxtLink (options: NuxtLinkOptions) { | |||
required: false, | |||
}, | |||
}, | |||
useLink: useNuxtLink, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What does this do?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This matches RouterLink
behaviour (which exposes a 'bound' composable which other libraries, like vuetify, can use to create custom links): https://router.vuejs.org/guide/advanced/composition-api.html#useLink.
@@ -120,6 +120,79 @@ export function defineNuxtLink (options: NuxtLinkOptions) { | |||
return resolvedPath | |||
} | |||
|
|||
function useNuxtLink (props: NuxtLinkProps) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just FYI this logic has some legacy issues, see #25532
I wouldn't consider fixing them as part of this PR but it will likely be updated in the future.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Exactly. β€οΈ Just wanted to check that this implementation would be compatible with the tree-shaking/bundle size improvements you have in mind.
Looks good, nice job. Didn't sanity check all of the logic but if tests are passing it should be good π€· |
π Linked issue
resolves #22169
β Type of change
π Description
Check title: I need to add a test and include
useLink
typeπ Checklist