2. 入口文件

入口文件 index.ts 里全是 export 语句,大约有以下几类 API:

  1. history 模块

  2. matcher 模块

  3. router 模块

  4. RouterView 模块

  5. RouterLink 模块

  6. navigationGuards 模块

  7. errors 模块

  8. 其它

    1. query

    2. useApi

    3. globalExtensions

    4. injectionSymbols

    5. config

    6. types

// history 
export { createWebHistory } from './history/html5'
export { createMemoryHistory } from './history/memory'
export { createWebHashHistory } from './history/hash'
export type { RouterHistory, HistoryState } from './history/common'

// matcher
export { createRouterMatcher } from './matcher'
export type { RouterMatcher } from './matcher'
export type { RouteRecord, RouteRecordNormalized } from './matcher/types'
export type { PathParserOptions, _PathParserOptions } from './matcher/pathParserRanker'

// router, RouterView, RouterLink
export { createRouter } from './router'
export type { Router, RouterOptions, RouterScrollBehavior } from './router'

export { RouterView } from './RouterView'
export type { RouterViewProps } from './RouterView'

export { RouterLink, useLink } from './RouterLink'
export type { _RouterLinkI, RouterLinkProps, UseLinkOptions } from './RouterLink'

// navigationGuards
export {
  onBeforeRouteLeave,
  onBeforeRouteUpdate,
  loadRouteLocation,
} from './navigationGuards'

// errors
export { NavigationFailureType, isNavigationFailure } from './errors'
export type { NavigationFailure, ErrorTypes, NavigationRedirectError } from './errors'

Last updated