import { ComputedRef, Ref } from 'vue'; import { PrefetchConfig } from './prefetch'; import { ResolvedRoute } from './resolved'; import { RouterPushOptions } from './routerPush'; import { RouterReplaceOptions } from './routerReplace'; import { UrlString } from './urlString'; export type UseLink = { /** * A template ref to bind to the dom for automatic prefetching */ element: Ref; /** * ResolvedRoute if matched. Same value as `router.find` */ route: ComputedRef; /** * Resolved URL with params interpolated and query applied. Same value as `router.resolve`. */ href: ComputedRef; /** * True if route matches current URL or is ancestor of route that matches current URL */ isMatch: ComputedRef; /** * True if route matches current URL. Route is the same as what's currently stored at `router.route`. */ isExactMatch: ComputedRef; /** * True if route matches current URL, or is a parent route that matches the parent of the current URL. */ isActive: ComputedRef; /** * True if route matches current URL exactly. */ isExactActive: ComputedRef; /** * */ isExternal: ComputedRef; /** * Convenience method for executing `router.push` with route context passed in. */ push: (options?: RouterPushOptions) => Promise; /** * Convenience method for executing `router.replace` with route context passed in. */ replace: (options?: RouterReplaceOptions) => Promise; }; export type UseLinkOptions = RouterPushOptions & { prefetch?: PrefetchConfig; };