feat: 文件命名规则修改
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user