vue-router的index.js文件配置参数

RouteConfig 的类型定义:interface RouteConfig = {path: string,component?: Component,name?: string, // 命名路由components?: { [name: string]: Component }, // 命名视图组件redirect?: string | Location |...

RouteConfig 的类型定义:

interface RouteConfig = {
  path: string,
  component?: Component,
  name?: string, // 命名路由
  components?: { [name: string]: Component }, // 命名视图组件
  redirect?: string | Location | Function,
  props?: boolean | Object | Function,
  alias?: string | Array<string>,
  children?: Array<RouteConfig>, // 嵌套路由
  beforeEnter?: (to: Route, from: Route, next: Function) => void,
  meta?: any,

  // 2.6.0+
  caseSensitive?: boolean, // 匹配规则是否大小写敏感?(默认值:false)
  pathToRegexpOptions?: Object // 编译正则的选项
}

参数具体作用见官方文档
https://router.vuejs.org/zh/api/#base

本文标题为:vue-router的index.js文件配置参数

基础教程推荐