Skip to content
Discussion options

You must be logged in to vote

You use definePage() to override the path and override the regexp of the parameter:

<script setup lang="ts>
definePage({
  path: '/:fruit(watermelon|strawberry)',
})
</script>

If the match is more complex, you will need to setup a navigation guard so you can freely do any check:

<script setup>
definePage({
  beforeEnter(to) {
    if (Number.isNaN(Number(to.params.id))) {
      console.log('invalid param id', to.params.id)
      return false
    }
  },
})
<script>

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@mkeyy0
Comment options

@posva
Comment options

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