react-environment-setup
v1.0.54
Published
react-environment-setup
Downloads
224
Readme
react-environment-setup
简介
react-environment-setup 用于React项目自动化创建,依赖于:
环境
Node (version >= 14.x)安装
npm install react-environment-setup -g运行
res生成路由
- vite项目、webpack项目路由文件路径:src/routes/index.tsx
- umi项目路由文件路径:config/routes.ts
- 自定义路由文件路径:使用package.json中routes字段指向路由文件路径
- 自定义配置模版目录:使用package.json中template字段指向模版目录,目录下必须存在三个文件:index.tsx、table.tsx、service.tsx
- 在路由文件中添加路由,内容如:
{
path: '/parent',
name: '父级路由中文名称',
icon: 'smile',
routes: [
{
path: '/parent/child',
name: '子级路由中文名称',
component: './Parent/Child',
table: true, // 是否是一体化表格组件
service: true, // 是否添加service文件
cover: true, // 已有文件是否覆盖
}
]
}- 运行命令
res router生成菜单
- 运行命令
res menu