Router Construction Options (En)
Cette page est en cours de traduction française. Revenez une autre fois pour lire une traduction achevée ou participez à la traduction française ici.
-
type:
Array<RouteConfig>
Type declaration for
RouteConfig
:declare type RouteConfig = { path: string; component?: Component; name?: string; // for named routes components?: { [name: string]: Component }; // for named views redirect?: string | Location | Function; props?: boolean | string | Function; alias?: string | Array<string>; children?: Array<RouteConfig>; // for nested routes beforeEnter?: (to: Route, from: Route, next: Function) => void; meta?: any; }
-
type:
string
-
default:
"hash" (in browser) | "abstract" (in Node.js)
-
available values:
"hash" | "history" | "abstract"
Configure the router mode.
-
hash
: uses the URL hash for routing. Works in all Vue-supported browsers, including those that do not support HTML5 History API. -
history
: requires HTML5 History API and server config. See HTML5 History Mode. -
abstract
: works in all JavaScript environments, e.g. server-side with Node.js. The router will automatically be forced into this mode if no browser API is present.
-
-
type:
string
-
default:
"/"
The base URL of the app. For example, if the entire single page application is served under
/app/
, thenbase
should use the value"/app/"
.
-
type:
string
-
default:
"router-link-active"
Globally configure
<router-link>
default active class. Also see router-link.
2.5.0+
-
type:
string
-
default:
"router-link-exact-active"
Globally configure
<router-link>
default active class for exact matches. Also see router-link.
-
type:
Function
Signature:
( to: Route, from: Route, savedPosition?: { x: number, y: number } ) => { x: number, y: number } | { selector: string } | ?{}
For more details see Scroll Behavior.
2.4.0+
-
type:
Function
Provide custom query string parse / stringify functions. Overrides the default.