Skip to content

Types: Router<TRoutes, TOptions, TPlugin>

ts
type Router<TRoutes, TOptions, TPlugin> = object;

Type Parameters

Type ParameterDefault type
TRoutes extends Routesany
TOptions extends RouterOptionsany
TPlugin extends RouterPluginany

Properties

PropertyTypeDescription
back() => voidNavigates to the previous entry in the browser's history stack.
find(url, options?) => ResolvedRoute | undefinedCreates a ResolvedRoute record for a given URL.
forward() => voidNavigates to the next entry in the browser's history stack.
go(delta) => voidMoves the current history entry to a specific point in the history stack.
install(app) => voidInstalls the router into a Vue application instance.
isExternal(url) => booleanGiven a URL, returns true if host does not match host stored on router instance
onAfterRouteEnterAddAfterRouteHookRegisters a hook to be called after a route is entered.
onAfterRouteLeaveAddAfterRouteHookRegisters a hook to be called after a route is left.
onAfterRouteUpdateAddAfterRouteHookRegisters a hook to be called after a route is updated.
onBeforeRouteEnterAddBeforeRouteHookRegisters a hook to be called before a route is entered.
onBeforeRouteLeaveAddBeforeRouteHookRegisters a hook to be called before a route is left.
onBeforeRouteUpdateAddBeforeRouteHookRegisters a hook to be called before a route is updated.
prefetch?PrefetchConfigDetermines what assets are prefetched.
pushRouterPush<TRoutes | TPlugin["routes"]>Navigates to a specified path or route object in the history stack, adding a new entry.
refresh() => voidForces the router to re-evaluate the current route.
rejectRouterReject< | keyof TOptions["rejections"] | KeysOfUnion<TPlugin["rejections"]>>Handles route rejection based on a specified rejection type.
replaceRouterReplace<TRoutes | TPlugin["routes"]>Replaces the current entry in the history stack with a new one.
resolveRouterResolve<TRoutes | TPlugin["routes"]>Creates a ResolvedRoute record for a given route name and params.
route| RouterRoutes<TRoutes> | RouterRoutes<TPlugin["routes"]>Manages the current route state.
start() => Promise<void>Initializes the router based on the initial route. Automatically called when the router is installed. Calling this more than once has no effect.
startedRef<boolean>Returns true if the router has been started.
stop() => voidStops the router and teardown any listeners.