Last active
July 28, 2023 05:19
-
-
Save hazadus/3fcfe32dd8840d4f8061d4124c2cc210 to your computer and use it in GitHub Desktop.
Reactive Routes in Nuxt 3/Vue
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script setup> | |
// Doesn't change when route changes | |
const route = useRoute(); | |
// Changes when route changes | |
const path = useRoute().path; | |
// If we need the full route object in a reactive way, we can do this: | |
// | |
// Doesn't change when route changes | |
const route = useRoute(); | |
// Changes when route changes | |
const route = useRouter().currentRoute.value; | |
</script> | |
<template> | |
</template> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment