How to redirect to default path? (migrating from Vue2) #1984
Unanswered
arthabus
asked this question in
Help and Questions
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I have nested views and I need to redirect user to their default destination when they land to a parent route (like "/app" -> "/app/dashboard/list")
This was all working fine in
Vue Router v3
but now I'm trying to figure out what are the options withVue Router v4
as it seems like that bit changed and it breaks lots of the logic in our app.Consider the following router:
This is how it worked in the
Vue Router v3
(user starts with/app
):/app
-> redirects to/app/dashboard
/app/dashboard
-> redirects to/app/dashboard/list
But now in
Vue Router v4
it just does this:/app
-> redirects to/dashboard/list
And when there is a third level of redirects it seems like the second redirect is completely ignored:
For example:
landing to "/" redirects to /2 (why not to /1?)
landing to "/1" also redirects to /2 (this doesn't seem to be consistent with the above redirect)
landing to /1/2 redirects to /3
While in all cases I expect user to be redirected to "/1/2/3" when they land to either "/", "/1" or "/1/2"
This used to work in
Vue Router v3
, but how to achieve that withVue Router 4
?Beta Was this translation helpful? Give feedback.
All reactions