1.3.5 • Published 6 years ago

dva-base-models v1.3.5

Weekly downloads
3
License
MIT
Repository
github
Last release
6 years ago

dva-base-models

GitHub license npm Version GitHub stars GitHub issues GitHub commit activity

基于 dva 的基础 model 配置

curdModel 增删改查 model

config

参数说明类型默认值
getList配置如何从接口响应中得到数据列表和分页器(response) => ({ list: [], pagination: {} })-
getData配置如何从接口响应中得到对象详情(response) => ({})-
isResponseOk判断接口是否成功(response) => boolean-

set

参数说明类型默认值
fetchMethod带查询参数的数据列表请求方法(paylaod) => Response-
isolatedGetList单独定义 model 的 getList(Response) => data-
parallelFetchActions与查询并行的 action 列表string[][]
afterFetchActions查询后需要回调的 action 列表string[][]
detailMethod对象详情请求方法(id) => Response-
isolatedGetData单独定义 model 的 getData(Response) => data-
parallelDetailActions与详情并行的 action 列表string[][]
afterDetailActions详情后需要回调的 action 列表string[][]
createMethod新建对象请求方法(paylaod) => Response-
afterCreateActions创建后需要回调的 action 列表string[][]
updateMethod更新对象请求方法(id, paylaod) => Response-
afterUpdateActions更新后需要回调的 action 列表string[][]
deleteMethod更新对象请求方法(id) => Response-
afterDeleteActions删除后需要回调的 action 列表string[][]
extraState额外的 state ,可覆盖默认 state{}{}
extraEffects额外的 effect ,可覆盖默认 effect{}{}
extraReducers额外的 reducer ,可覆盖默认 reducer{}{}

使用方法

  • 配置 config : getListgetDataisResponseOk
  • 配置 set : fetchMethoddetailMethodcreateMethodupdateMethoddeleteMethod

具体使用参考 Demo ,配置 curdModel.config 后导出 curdModel.set

1.3.5

6 years ago

1.3.4

6 years ago

1.3.3

6 years ago

1.3.2

6 years ago

1.3.1

6 years ago

1.3.0

6 years ago

1.2.0

6 years ago

1.1.8

6 years ago

1.1.7

6 years ago

1.1.6

6 years ago

1.0.6

6 years ago

1.0.5

6 years ago

1.0.4

6 years ago

1.0.3

6 years ago

1.0.2

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago