-
-
Notifications
You must be signed in to change notification settings - Fork 91
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
Support redirect
option in custom route block
#107
Comments
Right now, redirect records can be added through extendRoutes. maybe we can find other ways |
stumble upon this exactly today, ended up creating empty page to redirecting to the intended route. probably adding it to the docs is a good choice for now |
Now I'm defining the |
I still think redirects should be defined without the need of creating an empty component. I'm thinking of different possibilities:
To me, the last one makes the most sense, it's also easy to create the file by default with an empty object and some comments to point out how to use it |
How can define redirect in extendRoutes? |
Could you explain it how you did? |
you can use the definePage() macro , it work better |
I think the last option is a good one. It might be worth calling the file simply I seem to recall this mentioned elsewhere in one of the discussions here, so perhaps the two can be combined? |
can you show a simple example for how we can do it ? |
How are you supposed to do the redirect?
This doesn't seem to work |
The best way to do this is by pushing new routes at runtime: import { createRouter, createWebHistory } from 'vue-router'
import { routes } from 'vue-router/auto-routes'
routes.push({
path: '/path-to-redirect',
redirect: '/redirected-path',
})
export const router = createRouter({
history: createWebHistory(),
routes,
}) When this issue was created, the |
The text was updated successfully, but these errors were encountered: