Skip to content

Commit

Permalink
fix: 调整文档
Browse files Browse the repository at this point in the history
  • Loading branch information
yaob421123 committed Apr 19, 2023
1 parent 1ece941 commit fb1ec1e
Showing 1 changed file with 15 additions and 16 deletions.
31 changes: 15 additions & 16 deletions examples/website/src/pages/models/README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,23 @@
# 全局数据状态管理

> `kktp`配置 `initModel` 生效
- 简化 @rematch/* 状态管理公共进行初始化;
- 约定是到 model 组织方式,不用手动注册 model
- 文件名即 name,model 内如果没有声明 name,会以文件名作为 name
- 内置 @rematch/loading,直接 loading 字段使用即可
- [更多 @rematch/core api](https://rematchjs.org/docs/api-reference)

## kktp配置文件

```ts
// .kktprc.ts
export default {
// ...
initModel:true,
}
```

## store

> @rematch/core 的 init 初始化生成的状态存储
Expand Down Expand Up @@ -71,13 +83,12 @@ export default model;

## 类型

通过 @uiw-admin/models 导出类型:`FullModel``Store``AddModel``Dispatch``RootState``ModelDefault``RootModel`
通过 @kkt/pro 导出类型:`FullModel``Store``AddModel``Dispatch``RootState``ModelDefault``RootModel`

## model 用例

```ts
import { RootModel } from '@kkt/pro'
import { createModel } from '@rematch/core'
import { RootModel, createModel } from '@kkt/pro'
import { selectById } from '../servers/demo'

const demo = createModel<RootModel>()({
Expand Down Expand Up @@ -126,9 +137,7 @@ export default demo

```tsx
import React from 'react'
import { useDispatch,useSelector } from 'react-redux'
import { Dispatch } from '@kkt/pro'
import { RootState } from '@kkt/pro'
import { Dispatch, RootState, useDispatch,useSelector } from '@kkt/pro';

const Demo = () => {
const dispatch = useDispatch<Dispatch>()
Expand All @@ -151,16 +160,6 @@ export default Demo

```

## kktp配置文件

```ts
// .kktprc.ts
export default {
// ...
initModel:true,
}
```

## 贡献者

感谢所有的贡献者,欢迎开发者为开源项目贡献力量。
Expand Down

0 comments on commit fb1ec1e

Please sign in to comment.