Skip to content

routesFolder with param #272

Closed Answered by posva
mathieu-gilloots asked this question in Q&A
Discussion options

You must be logged in to vote

You can pass a custom regexp to params (vue router): path: ':lang(en|es|fr)'. You could also validate them in a beforeEach guard. That allows to have a dynamic list rather than one set at built time, it depends on what you need.
You detect changes to the param with a watcher, like any other reactive property in vue.

<script setup>
const route = useRoute()
watch(() => route.params.lang, (lang, oldLang) => {
})
</script>

(imports omitted)

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@mathieu-gilloots
Comment options

Answer selected by posva
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #271 on December 13, 2023 22:05.