I have this folder setup:
consultations/
--| _id/
-----| _slug.vue
--| _filter.vue
Everything works fine, but when I go to /consultations/1234
it gets captured by _filter
How can I force it to be captured by _slug.vue
instead?
I have this folder setup:
consultations/
--| _id/
-----| _slug.vue
--| _filter.vue
Everything works fine, but when I go to /consultations/1234
it gets captured by _filter
How can I force it to be captured by _slug.vue
instead?
Yeah, the wording of this is a bit messy IMO, but you do have:
/consultations/1234
, accessed with this.$route.params.id
/consultations?age=today
, accessed with this.$route.query.age
Not sure if this blog post may clarify it a bit.
A bit confusing but really not the same thing!
From your routes, if you want to access the _slug.vue
, you need to reach for /consultations/1234/my-cool-slug
.
Otherwise, you need to check your folder structure again or change how _filter
is caught.
Don't you want to have it as a query param like /consultations?age=today&type=dentist
?
You may have several filters and not just a single one.
TLDR: you cannot have a priority, it is decided by the schema you're providing and it will always take the shortest route matching as far as I know.