Unresolved variable or type $route #8362
-
I have installed a new Vue project. And when using $route in the template, I get the error Unresolved variable or type $route. But the code itself works. I use the Webstorm IDE
"vue": "^3.3.2",
"@types/node": "^18.16.8",
<RouterView
:class="{ 'sm:ml-68': $route.meta.sideDrawer && stateDrawer }"
class="p-4 bg-background h-full sm:h-screen"
/>
Beta Was this translation helpful? Give feedback.
All reactions
Replies: 2 comments 1 reply
-
Setting > Languanges & Frameworks > JavaScript > Libraries
add @types/jquery
Beta Was this translation helpful? Give feedback.
All reactions
-
Upgrade vue-router
to latest.
Beta Was this translation helpful? Give feedback.
All reactions
-
Still having the issue using IntelliJ IDEA, updating vue-router
does not solve it.
Installed new project from scratch using Vue start and then installed Nuxt.
Configured route example as below:
imageHere's my package.json:
{ "name": "nuxt-app", "private": true, "type": "module", "scripts": { "build": "nuxt build", "dev": "nuxt dev", "generate": "nuxt generate", "preview": "nuxt preview", "postinstall": "nuxt prepare" }, "dependencies": { "@nuxt/content": "3.4.0", "@nuxt/eslint": "1.2.0", "@nuxt/fonts": "0.11.0", "@nuxt/icon": "1.11.0", "@nuxt/image": "1.10.0", "@nuxt/scripts": "0.11.2", "@nuxt/ui": "3.0.1", "@unhead/vue": "^2.0.0-rc.8", "bindings": "^1.5.0", "eslint": "^9.0.0", "nuxt": "^3.16.1", "typescript": "^5.6.3", "vue": "^3.5.13", "vue-router": "^4.5.0" }, "pnpm": { "onlyBuiltDependencies": [ "@parcel/watcher", "better-sqlite3", "esbuild", "sharp", "vue-demi" ] }, "devDependencies": { "@vue/language-server": "^2.2.8" } }
Beta Was this translation helpful? Give feedback.