How to set dynamic base route in vue router #1935
-
I need to set a dynamic base route(i.e. every route will follow this path) for my app. e.g. In
So, is there any way to achieve this behaviour? Any idea will be appreciated. Thanks in advance. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
If by dynamic you mean adding a param to the base, you can't do that because a If you want to apply a param to all routes, add one to a route with children: routes: [
{
path: '/domain/t/:id',
children: [
{ path: 'sub-path' },
// ...
]
}
] This will create routes |
Beta Was this translation helpful? Give feedback.
If by dynamic you mean adding a param to the base, you can't do that because a
base
is to host the app on a sub path on your domain rather than the root. e.g. hosting atexample.com/app
rather thanexample.com
, so it doesn't change.If you want to apply a param to all routes, add one to a route with children:
This will create routes
/domain/t/.../sub-path