-
-
Notifications
You must be signed in to change notification settings - Fork 86
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
Allow defining route options when there is no component
#318
Comments
component
I'm glad you enjoy it! There should be a more generic way to add options to a route that do not have a component. I still need to figure out how this would be present as a file, a special suffix |
Looking forward to new progress on it. |
This is related to It will likely be allowed with a custom file |
For who's interested, I added a temporary implementation for the |
Description
First off, absolutely love this project, and there is just one thing that I can't figure out that is preventing me from switching over to this awesomeness. So thank you for building it.
Problem / Opportunity
How might we add a
beforeEnter()
guard to a dynamic folder entry.For example - check out the existing vue router setup:
The dynamic
/:lang
folder entry in the above routes declaration has abeforeEnter()
guard to check if the lang param is valid (en / fr).The problem then, is, how would I achieve this using the plugin.
Assuming the following directory structure:
The challenge with the above is that I'm not sure how to add a
beforeEnter()
route guard to the[lang]
dynamic folder entry as there is no corresponding code to add it to.Option, but not great
One option I thought of was using the https://uvr.esm.is/guide/extending-routes.html Extending Routes feature, however I didn't love the idea of adding this logic in the vite config file.
I think if there was a way to add it to the
router/index.js
it would be a bit cleaner.Alternatively, I could add the route guard code to the global
router.beforeEach
however I'm not sure how to only limit that function to the specific dynamic path.Hope that makes sense?
Thanks.
The text was updated successfully, but these errors were encountered: