Recently, I updated to the latest version of Nuxt and encountered an issue with the useRoute
method. Even though it works, I keep getting a "Cannot Find name useRoute"
error message. Can anyone help me figure out what might be missing?
<script lang="ts" setup>
const routes = useRoute();
</script>
<template>
</template>
In my package.json
, these are the versions I am using:
"devDependencies": {
"@nuxt/devtools": "latest",
"@types/node": "^18",
"nuxt": "^3.6.1"
},
"dependencies": {
"@nuxt/image": "^1.0.0-rc.1",
"@nuxtjs/tailwindcss": "^6.8.0",
"@vuepic/vue-datepicker": "^5.3.0",
"nuxt-icon": "^0.4.1",
"nuxt-swiper": "^1.1.1"
}
Although useRoute
autocompletes perfectly in pages/index.vue
, if I attempt to use it in another Vue file or directory within pages, the same error persists.