router alias relative location doesn't work #2303
-
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 1 reply
-
it doesn't like vue docs teach me. relative location doesn't start with '/' |
Beta Was this translation helpful? Give feedback.
-
maybe the docs description is wrong. should be fix it. |
Beta Was this translation helpful? Give feedback.
-
Which part of the docs are you looking at? You can use a relative path with e.g.: {
path: '/user',
component: UserView,
children: [
{
path: 'hello',
alias: 'abc',
component: ListView
}
]
}, The 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 children then it might be simpler to skip the nesting and use |
Beta Was this translation helpful? Give feedback.
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 thepath
. It isn't relative to thepath
of the current route. In your example the route doesn't have a parent, so it can't use a relative path.e.g.:
The
alias
above maps to/user/abc
.Applying that to your code, you could maybe write it something like this:
If you don't have any other …