Skip to content

Mandatory query params for same route path? #1955

Closed Answered by posva
iustin-gheorghe asked this question in Help and Questions
Discussion options

You must be logged in to vote

the path is just the path, it doesn't contain the query, that's why your declaration with a custom regex do not work.

For this kind of scenario, using a navigation guard is the way to go:

router.beforeEach((to) => {
  if (to.name === 'my-route-to-check') {
    // ...
  }
})

There are a few extra examples in the docs. This page is also worth checking for your case.

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@iustin-gheorghe
Comment options

@posva
Comment options

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