使用Redux+Antd+TypeScript创建React应用, 使用ESLint作为项目linter
tsconfig.json,如下:
"paths": {
"src/*": ["src/*"],
"components/*":["src/components/*"],
"pages/*":["src/pages/*"],
"utils/*":["src/utils/*"],
"redux/*":["src/redux/*"],
"services/*":["src/services/*"]
},
router 配置文件src/router/routes.tsx
,路由地址不要以 "/" 结尾。
面包屑的显示与路由的path
路径的层级关联,如下路由配置:
{
title: "普通一级菜单",
icon: "eye",
path: "/common-level",
exact: true,
component: About
},
{
title: "一级—非嵌套子级",
icon: "bulb",
path: "/common-level/no-nest-sub",
component: account
},
/common-level
对应:普通一级菜单
,/common-level/no-nest-sub
对应:一级—非嵌套子级
,最终面包屑渲染的层级为:普通一级菜单/一级—非嵌套子级
,且普通一级菜单
可点。