1. 路由可配置多個
2. 路由包含嵌套子路由
3. 路由可以別名
4. 路由單獨鈎子
5. vue2.6.0(可以直接匹配大小寫)
1 export default new Router({ 2 mode: 'history', //路由模式,取值為history與hash
3 base: '/', //打包路徑,默認為/,可以修改
4 routes: [ 5 { 6 path: string, //路徑
7 ccomponent: Component; //頁面組件
8 name: string; // 命名路由-路由名稱
9 components: { [name: string]: Component }; // 命名視圖組件
10 redirect: string | Location | Function; // 重定向
11 props: boolean | string | Function; // 路由組件傳遞參數
12 alias: string | Array<string>; // 路由別名
13 children: Array<RouteConfig>; // 嵌套子路由
14 beforeEnter?: (to: Route, from: Route, next: Function) => void; // 路由單獨鈎子
15 meta: any; // 自定義標簽屬性,比如:是否需要登錄
16 icon: any; // 圖標
17 // 2.6.0+
18 caseSensitive: boolean; // 匹配規則是否大小寫敏感?(默認值:false)
19 pathToRegexpOptions: Object; // 編譯正則的選項
20 } 21 ] 22 })