Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

Unresolved variable or type $route #8362

Unanswered
MaYoRr asked this question in Help/Questions
May 18, 2023 · 2 comments · 1 reply
Discussion options

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"
 />
You must be logged in to vote

Replies: 2 comments 1 reply

Comment options

Setting > Languanges & Frameworks > JavaScript > Libraries
add @types/jquery

You must be logged in to vote
0 replies
Comment options

Upgrade vue-router to latest.

vuejs/router#1843

You must be logged in to vote
1 reply
Comment options

Still having the issue using IntelliJ IDEA, updating vue-router does not solve it.

image

Installed new project from scratch using Vue start and then installed Nuxt.

Configured route example as below:

image

Here'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"
 }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

AltStyle によって変換されたページ (->オリジナル) /