-
-
Notifications
You must be signed in to change notification settings - Fork 5.3k
feat(nuxt): use build plugin to access nuxt route injection #21585
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
Conversation
Co-authored-by: SΓ©bastien Chopin <seb@nuxt.com>
Not sure that this should be as an experimental feature since it actually give the same behavior without and with vue-router. Also, I also think that the I would consider this as a bug fix IMO. Happy to discuss about it if you see it with another POV. |
Agreed. However, personally I would advise against using these kind of injections as much as possible in the template as it makes the 'dependencies' of the component less explicit. Yet the main issue I have is that I'm not sure of the impact on performance. We might be able instead to transform and auto execute useRoute based on usage. What do you think? |
$route
injection synced
@antfu Would love your thoughts on whether it's safe to access |
I am not about the approach of injecting on every Vue file. Instead, maybe we should hijack/proxy the vue-router plugin, to register the global |
Oh, sorry - I updated it in the last commit so it doesn't inject in every file but directly accesses the inject in ctx only if the |
@antfu Very up for a different implementation here, but wanted to get this in for 3.7 release. |
π Linked issue
resolves #20674
β Type of change
π Description
This adds an experimental option to sync
$route
template object with the Nuxt-managed route.π Checklist