Types: Router<TRoutes, TOptions, TPlugin>
ts
type Router<TRoutes, TOptions, TPlugin> = object;Type Parameters
| Type Parameter | Default type |
|---|---|
TRoutes extends Routes | any |
TOptions extends RouterOptions | any |
TPlugin extends RouterPlugin | any |
Properties
| Property | Type | Description |
|---|---|---|
back | () => void | Navigates to the previous entry in the browser's history stack. |
find | (url, options?) => ResolvedRoute | undefined | Creates a ResolvedRoute record for a given URL. |
forward | () => void | Navigates to the next entry in the browser's history stack. |
go | (delta) => void | Moves the current history entry to a specific point in the history stack. |
install | (app) => void | Installs the router into a Vue application instance. |
isExternal | (url) => boolean | Given a URL, returns true if host does not match host stored on router instance |
onAfterRouteEnter | AddRouterAfterRouteHook<TRoutes | TPlugin["routes"], | RejectionType<TOptions["rejections"]> | RejectionType<TPlugin["rejections"]>> | Registers a hook to be called after a route is entered. |
onAfterRouteLeave | AddRouterAfterRouteHook<TRoutes | TPlugin["routes"], | RejectionType<TOptions["rejections"]> | RejectionType<TPlugin["rejections"]>> | Registers a hook to be called after a route is left. |
onAfterRouteUpdate | AddRouterAfterRouteHook<TRoutes | TPlugin["routes"], | RejectionType<TOptions["rejections"]> | RejectionType<TPlugin["rejections"]>> | Registers a hook to be called after a route is updated. |
onBeforeRouteEnter | AddRouterBeforeRouteHook<TRoutes | TPlugin["routes"], | RejectionType<TOptions["rejections"]> | RejectionType<TPlugin["rejections"]>> | Registers a hook to be called before a route is entered. |
onBeforeRouteLeave | AddRouterBeforeRouteHook<TRoutes | TPlugin["routes"], | RejectionType<TOptions["rejections"]> | RejectionType<TPlugin["rejections"]>> | Registers a hook to be called before a route is left. |
onBeforeRouteUpdate | AddRouterBeforeRouteHook<TRoutes | TPlugin["routes"], | RejectionType<TOptions["rejections"]> | RejectionType<TPlugin["rejections"]>> | Registers a hook to be called before a route is updated. |
onError | AddRouterErrorHook<TRoutes | TPlugin["routes"], | RejectionType<TOptions["rejections"]> | RejectionType<TPlugin["rejections"]>> | Registers a hook to be called when an error occurs. If the hook returns true, the error is considered handled and the other hooks are not run. If all hooks return false the error is rethrown |
prefetch? | PrefetchConfig | Determines what assets are prefetched. |
push | RouterPush<TRoutes | TPlugin["routes"]> | Navigates to a specified path or route object in the history stack, adding a new entry. |
refresh | () => void | Forces the router to re-evaluate the current route. |
reject | RouterReject< | RejectionType<TOptions["rejections"]> | RejectionType<TPlugin["rejections"]>> | Handles route rejection based on a specified rejection type. |
replace | RouterReplace<TRoutes | TPlugin["routes"]> | Replaces the current entry in the history stack with a new one. |
resolve | RouterResolve<TRoutes | TPlugin["routes"]> | Creates a ResolvedRoute record for a given route name and params. |
route | | RouterRouteUnion<TRoutes> | RouterRouteUnion<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. |
started | Ref<boolean> | Returns true if the router has been started. |
stop | () => void | Stops the router and teardown any listeners. |