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

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

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

feat(nuxt3): support custom prop for <nuxt-link>#4249
pi0 merged 14 commits into
nuxt: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

Resolvesnuxt/nuxt#13485

📝 Checklist

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

@netlify

netlifyBot commented Apr 11, 2022

Copy link
Copy Markdown

Deploy Preview for nuxt3-docs canceled.

NameLink
🔨 Latest commitb4b2925
🔍 Latest deploy loghttps://app.netlify.com/sites/nuxt3-docs/deploys/62c7178ad75ed600088a3f3a

Comment threadpackages/nuxt3/src/app/components/nuxt-link.ts
@pi0pi0 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
ContributorAuthor

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
ContributorAuthor

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)

@pi0pi0Apr 11, 2022

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.

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

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

danielroe commented Jun 9, 2022

Copy link
Copy Markdown
Member

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 pi0June 9, 2022 15:34
@pi0

pi0 commented Jun 10, 2022

Copy link
Copy Markdown
Member

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 approved these changes Jul 7, 2022
@pi0
pi0 merged commit 38e0fa6 into nuxt:mainJul 7, 2022
@pi0

pi0 commented Jul 7, 2022

Copy link
Copy Markdown
Member

Thanks <3

@pi0pi0 mentioned this pull request Jul 11, 2022
Sign up for freeto subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

3.xenhancementNew 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

@frbuceta@danielroe@pi0