mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-11 08:33:53 +00:00
fix(nuxt): type useRoute
return (#6395)
This commit is contained in:
parent
58abefc326
commit
4623525f3f
@ -8,16 +8,16 @@ export const useRouter = () => {
|
||||
return useNuxtApp()?.$router as Router
|
||||
}
|
||||
|
||||
export const useRoute = () => {
|
||||
export const useRoute = (): RouteLocationNormalizedLoaded => {
|
||||
if (getCurrentInstance()) {
|
||||
return inject<RouteLocationNormalizedLoaded>('_route', useNuxtApp()._route)
|
||||
return inject('_route', useNuxtApp()._route)
|
||||
}
|
||||
return useNuxtApp()._route
|
||||
}
|
||||
|
||||
/** @deprecated Use `useRoute` instead. */
|
||||
export const useActiveRoute = () => {
|
||||
return useNuxtApp()._route as RouteLocationNormalizedLoaded
|
||||
export const useActiveRoute = (): RouteLocationNormalizedLoaded => {
|
||||
return useNuxtApp()._route
|
||||
}
|
||||
|
||||
export interface RouteMiddleware {
|
||||
|
Loading…
Reference in New Issue
Block a user