Skip to content

How to set dynamic base route in vue router #1935

Closed Answered by posva
smShakil asked this question in Help and Questions
Discussion options

You must be logged in to vote

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 at example.com/app rather than example.com, so it doesn't change.

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 /domain/t/.../sub-path

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
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