Skip to content
This repository was archived by the owner on Apr 6, 2023. It is now read-only.

feat(nuxt3): support custom prop for <nuxt-link>#4249

Merged
pi0 merged 14 commits intonuxt:mainfrom
frbuceta:fix-3657
Jul 7, 2022
Merged

feat(nuxt3): support custom prop for <nuxt-link>#4249
pi0 merged 14 commits intonuxt:mainfrom
frbuceta:fix-3657

Conversation

@frbuceta
Copy link
Copy Markdown
Contributor

🔗 Linked issue

nuxt/nuxt#13485

❓ Type of change

  • 📖 Documentation (updates to the documentation or readme)
  • 🐞 Bug fix (a non-breaking change that fixes an issue)
  • 👌 Enhancement (improving an existing functionality like performance)
  • ✨ New feature (a non-breaking change that adds functionality)
  • ⚠️ Breaking change (fix or feature that would cause existing functionality to change)

📚 Description

Resolves nuxt/nuxt#13485

📝 Checklist

  • I have linked an issue or discussion.
  • I have updated the documentation accordingly.

@netlify
Copy link
Copy Markdown

netlify Bot commented Apr 11, 2022

Deploy Preview for nuxt3-docs canceled.

Name Link
🔨 Latest commit b4b2925
🔍 Latest deploy log https://app.netlify.com/sites/nuxt3-docs/deploys/62c7178ad75ed600088a3f3a

Comment thread packages/nuxt3/src/app/components/nuxt-link.ts
@pi0 pi0 added enhancement New feature or request changes-requested labels Apr 11, 2022

return h('a', { href, rel, target }, slots.default())
return props.custom
? slots.default && slots.default({ href, rel, target })
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure about all possible context keys but shall we provide navigate (aliased to navigateTo) and rotue (lazy getter of useRoute) to be identicaL to vue-router API?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can provide them with the help of useLink, and also rel and target

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice idea but useLink implementation is not universal yet. We need to implement it here

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Something like that? (last commit)

Copy link
Copy Markdown
Member

@pi0 pi0 Apr 11, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, actually. Universal utils don't use vue-router dependency but mimic its API.

@pi0 pi0 changed the title fix(nuxt3): nuxt-link custom prop is not being passed to router-link feat(nuxt3): support custom prop for <nuxt-link> Apr 11, 2022
@danielroe
Copy link
Copy Markdown
Member

danielroe commented Jun 9, 2022

Pushed some fixes. Only question remaining in my mind is whether we want to normalise the bound props passed to the default slot between external/internal links. (so would need to pass a route object to an external link, etc.) WDYT @pi0?

@danielroe danielroe requested a review from pi0 June 9, 2022 15:34
@pi0
Copy link
Copy Markdown
Member

pi0 commented Jun 10, 2022

Only question remaining in my mind is whether we want to normalise the bound props passed to the default slot between external/internal links. (so would need to pass a route object to an external link, etc.) WDYT

How do you imagine extending vue-router's route type for external routes? In general, it wouldn't be a bad idea to me always providing a normalized route for external links as well.

@pi0 pi0 merged commit 38e0fa6 into nuxt:main Jul 7, 2022
@pi0
Copy link
Copy Markdown
Member

pi0 commented Jul 7, 2022

Thanks <3

@pi0 pi0 mentioned this pull request Jul 11, 2022
@danielroe danielroe added the 3.x label Jan 19, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

3.x enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Nuxt link does not have a disable or custom prop

3 participants