with vue3.4 + router4 or above useRoute() or useRouter() will return undefined
jesseice opened this issue · comments
jesseice commented
Reproduction
empty
Steps to reproduce the bug
const route = useRoute();
route // undefined
Expected behavior
return the current routing information
Actual behavior
return undefined
Additional information
No response
Eduardo San Martin Morote commented
useRoute()
must be used within script setup. It's only undefined when called in the wrong places. BTW, use discussions or the discord chat to ask questions, thanks!