vuejs / vue2-ssr-docs

Vue.js Server-Side Rendering Guide (for Vue 2)
565 stars 239 forks source link

useRoute and useRouter return undefined #331

Closed u007 closed 3 years ago

u007 commented 3 years ago

I'am unable to get both within my vue project, using:

  "vue-router": "^4.0.12"
import { useRoute, useRouter } from 'vue-router';
const $route = useRoute()
const $router = useRouter()
console.log('router?', $route, $router)

got these:

[Vue warn]: injection "Symbol([vue-router]: route location)" not found.
[Vue warn]: injection "Symbol([vue-router]: router)" not found.
router? undefined undefined
u007 commented 3 years ago

sorry wrong projet