mirror of
https://github.com/nuxt/nuxt.git
synced 2025-02-23 17:10:07 +00:00
Update router.ts
useRouter should fallback to useRouter from vue-router, as that will be cases where it is not defined
This commit is contained in:
parent
7b35a1fe4f
commit
e09b52088a
@ -13,7 +13,7 @@ import type { PageMeta } from '#app'
|
|||||||
import { PageRouteSymbol } from '#app/components/injections'
|
import { PageRouteSymbol } from '#app/components/injections'
|
||||||
|
|
||||||
export const useRouter: typeof _useRouter = () => {
|
export const useRouter: typeof _useRouter = () => {
|
||||||
return useNuxtApp()?.$router as Router
|
return useNuxtApp()?.$router ?? _useRouter() as Router
|
||||||
}
|
}
|
||||||
|
|
||||||
export const useRoute: typeof _useRoute = () => {
|
export const useRoute: typeof _useRoute = () => {
|
||||||
|
Loading…
Reference in New Issue
Block a user