Skip to content

v8: Reactive dynamic route params #1588

Answered by jbmolle
jbmolle asked this question in Q&A
Oct 27, 2022 · 1 comments · 17 replies
Discussion options

You must be logged in to vote

Hi,
I've found how to do it and I'm posting here so maybe it'll help other people.
In Nuxt 3 we can access the page meta through route.meta so:

<script setup>
const route = useRoute()
definePageMeta({
  nuxtI18n: {}
})
const slugFr = ref('initialValue')
watch(slugFr, (newSlug) => {
  route.meta.nuxtI18n = {
    en: { id: 'my-post' },
    fr: { id: newSlug }
  }
})
</script>

JB

Replies: 1 comment 17 replies

Comment options

You must be logged in to vote
17 replies
@katerlouis
Comment options

@jbmolle
Comment options

@katerlouis
Comment options

@jbmolle
Comment options

@katerlouis
Comment options

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