Skip to content
This repository has been archived by the owner on Aug 23, 2021. It is now read-only.

zqinmiao/react-app-antd-ts

Repository files navigation

react-app-antd-ts

使用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 配置

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对应:一级—非嵌套子级,最终面包屑渲染的层级为:普通一级菜单/一级—非嵌套子级,且普通一级菜单可点。

相关知识

React+TypeScript+Antd+TSLint脚手架搭建

历史版本

  • 基于 Create React App Adding TypeScript, 使用Redux+Antd+TypeScript创建React应用。使用TSLint作为项目linter。在这里

  • 基于umi脚手架创建,在这里