Interface RouteConfig

interface RouteConfig {
    action?: boolean | ActionFunction;
    autoReplaceTitle?: boolean;
    caseSensitive?: boolean;
    Component?: null | ComponentType<{}>;
    contentProps?: HTMLAttributes<HTMLDivElement>;
    disableBreadcrumbJump?: boolean;
    element?: RouteElement;
    ErrorBoundary?: null | ComponentType<{}>;
    errorElement?: ReactNode;
    handle?: any;
    hasErrorBoundary?: boolean;
    HydrateFallback?: null | ComponentType<{}>;
    hydrateFallbackElement?: ReactNode;
    id?: string;
    index?: boolean;
    isStatic?: boolean;
    keywords?: string[];
    lazy?:
        | LazyRouteFunction<NonIndexRouteObject>
        | LazyRouteFunction<IndexRouteObject>;
    loader?: boolean | LoaderFunction<any>;
    name: string;
    parent?: RouteConfig;
    parentNamePath?: string[];
    path?: string;
    permissionCode?: string;
    redirectTo?: string;
    routes?: RouteConfig[];
    shouldRevalidate?: ShouldRevalidateFunction;
    title?: string;
    type?: string;
    [key: string]: any;
}

Hierarchy (View Summary)

  • Omit<RouteProps, "children" | "element">
  • Record<string, any>

Indexable

  • [key: string]: any

Properties

action?: boolean | ActionFunction
autoReplaceTitle?: boolean

自动替换页面标题

caseSensitive?: boolean
Component?: null | ComponentType<{}>
contentProps?: HTMLAttributes<HTMLDivElement>

路由容器 props

disableBreadcrumbJump?: boolean

禁用面包屑跳转 某些带参数的 url 需要激活此选项以禁止点击面包屑时跳转页面

element?: RouteElement
ErrorBoundary?: null | ComponentType<{}>
errorElement?: ReactNode
handle?: any
hasErrorBoundary?: boolean
HydrateFallback?: null | ComponentType<{}>
hydrateFallbackElement?: ReactNode
id?: string
index?: boolean
isStatic?: boolean

是否静态, 默认 false, 非静态下 url 变更将强制组件重写渲染

keywords?: string[]

关键字 用于检索

lazy?:
    | LazyRouteFunction<NonIndexRouteObject>
    | LazyRouteFunction<IndexRouteObject>
loader?: boolean | LoaderFunction<any>
name: string

路由的 name,全局唯一

parent?: RouteConfig

父级路由 auto-routes 会根据 RouteConfig 层级自动注入,无需手动声明

parentNamePath?: string[]

嵌套层级路径,路由 name 的数组 用明确路由嵌套层级 auto-routes 会根据 RouteConfig 层级自动注入,无需手动声明

path?: string

路径

permissionCode?: string

权限代码, 控制路由能否被访问

redirectTo?: string

重定向

routes?: RouteConfig[]

子路由 子路由 path 与父级不存在嵌套关系

shouldRevalidate?: ShouldRevalidateFunction
title?: string

页面标题

type?: string

自定义参数, 视情况而定