feat: 文件命名规则修改

This commit is contained in:
dayjoy
2024-10-22 14:20:24 +08:00
parent e47cf31c07
commit 2a25a41be7
12 changed files with 42 additions and 32 deletions

View File

@@ -10,7 +10,7 @@
- dev
```shell
```shell[src](src)
yarn start
```
@@ -19,7 +19,7 @@
```shell
yarn build
```
## 路由和菜单
本工程采用配置化自动生成路由和菜单方案,在 `pages` 下的单个页面目录中配置 `meta.json` 文件,即可生成路由和菜单,具体配置如下:
@@ -57,8 +57,11 @@ interface Meta {
在每个页面内,可以使用以下常用方法和全局变量:
```
navigate页面跳转方法用法navigate('/path')
props页面 props
params当前页面路由参数
search当前页面搜索参数
location当前页面路由信息
navigate页面跳转方法用法navigate('/path')
tocoStore全局 store
tocoServices页面的请求
tocoRefs页面上所有带 id 组件的 refs
@@ -71,6 +74,7 @@ interface Meta {
```shell
src
├── App.tsx # 路由逻辑,一般不需要修改
├── Root.tsx # 页面根节点
├── app # store 主逻辑
│   └── store.ts # 如果写了新的 store需要在这里引入
├── components # 组件放这里
@@ -90,10 +94,10 @@ interface Meta {
│   └── index.tsx # 可以在这里切换布局方案
├── pages # 页面放这里
│   ├── demo # 一个页面一个文件夹
│   │   ├── Demo.module.css # 页面样式
│   │   ├── Demo.tsx # 页面逻辑
│   │   ├── demoAPI.ts # 页面请求
│   │   ├── demoSlice.ts # 页面 store
│   │   ├── index.module.css # 页面样式
│   │   ├── index.tsx # 页面逻辑
│   │   ├── api.ts # 页面请求
│   │   ├── slice.ts # 页面 store
│   │   └── meta.json # 页面元数据,用于生成路由和菜单,没有这个文件视为普通组件
│   └── test
├── react-app-env.d.ts