Router #
Navigation API of a KawaPress site, a small subset of Vue Router's.
Fields #
currentRouteReadonly<ShallowRef<Route>>
Route the app currently shows. Read it through useRoute() in components.
push(to: string): Promise<void>
Navigates to to and adds a history entry.
replace(to: string): Promise<void>
Navigates to to and replaces the current history entry.
beforeEach(guard: RouteGuard): () => void
Registers a guard; returns a function that removes it again.
afterEach(hook: RouteHook): () => void
Registers a post-navigation hook; returns a function that removes it.
Full type signature
TypeScript
interface Router {
readonly currentRoute: Readonly<ShallowRef<Route>>
push: (to: string) => Promise<void>
replace: (to: string) => Promise<void>
beforeEach: (guard: RouteGuard) => () => void
afterEach: (hook: RouteHook) => () => void
}

Comments