Skip to content

router alias relative location doesn't work #2303

Discussion options

You must be logged in to vote

Which part of the docs are you looking at?

You can use a relative path with alias, but it is relative to the parent route, just like the path. It isn't relative to the path of the current route. In your example the route doesn't have a parent, so it can't use a relative path.

e.g.:

{
  path: '/user',
  component: UserView,
  children: [
    {
      path: 'hello',
      alias: 'abc',
      component: ListView
    }
  ]
},

The alias above maps to /user/abc.

Applying that to your code, you could maybe write it something like this:

{
  path: '/hello',
  children: [
    {
      path: '',
      alias: 'abc',
      component: () => import('../Hello.vue')
    }
  ]
},

If you don't have any other …

Replies: 3 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@lyqyq2001
Comment options

Answer selected by posva
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants