8000 feat(nuxt): allow dynamic `scrollToTop` page meta by prashantpalikhe Β· Pull Request #21741 Β· nuxt/nuxt Β· GitHub
[go: up one dir, main page]

Skip to content

feat(nuxt): allow dynamic scrollToTop page meta #21741

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

Merged

Conversation

prashantpalikhe
Copy link
Contributor

πŸ”— Linked issue

#21738

❓ Type of change

  • πŸ“– Documentation (updates to the documentation, readme or JSdoc annotations)
  • 🐞 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)
  • 🧹 Chore (updates to the build process or auxiliary tools and libraries)
  • ⚠️ Breaking change (fix or feature that would cause existing functionality to change)

πŸ“š Description

This PR allows scrollToTop page meta to be a function besides a boolean. The function receives the destination route object as an argument.

This will allow users to dynamically set scrollToTop based on the route's params, query string, or path.

Resolves #21738

πŸ“ Checklist

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

@nuxt-studio
Copy link
Contributor
nuxt-studio bot commented Jun 24, 2023

βœ… Live Preview ready!

Name Edit Preview Latest Commit
Nuxt Docs Edit on Studio β†—οΈŽ View Live Preview 165fa47

@danielroe
Copy link
Member

Beautiful πŸ‘Œ

@IsraelOrtuno
Copy link
Contributor

Really nice feature. I was wondering if passing both from and to routes may be useful so you could make the decision to scroll to top with even more information, thoughts?

@prashantpalikhe
Copy link
Contributor Author

Really nice feature. I was wondering if passing both from and to routes may be useful so you could make the decision to scroll to top with even more information, thoughts?

That would definitely be quite useful. Wdyt @danielroe

@danielroe
Copy link
Member

I agree πŸ‘

@prashantpalikhe
Copy link
Contributor Author

Updated the PR @danielroe

@danielroe
Copy link
Member

Great! Thank you; we'll slot this in for the 3.7 release ❀️

@danielroe danielroe changed the title feat(nuxt): allow dynamic scrollToTop page meta feat(nuxt): allow dynamic scrollToTop page meta Jul 30, 2023
@danielroe danielroe merged commit 2616aad into nuxt:main Jul 30, 2023
@github-actions github-actions bot mentioned this pull request Jul 30, 2023
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.

Allow scrollToTop page meta be dynamic with a function that receives the destination route
3 participants
0