{"id":19071797,"url":"https://github.com/yunsii/dva-base-models","last_synced_at":"2025-02-22T04:16:24.241Z","repository":{"id":42653118,"uuid":"199677053","full_name":"yunsii/dva-base-models","owner":"yunsii","description":"📦 Base models config for dva.","archived":false,"fork":false,"pushed_at":"2023-03-06T02:29:36.000Z","size":428,"stargazers_count":1,"open_issues_count":8,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-14T02:51:26.870Z","etag":null,"topics":["curd","dva","model"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/yunsii.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2019-07-30T15:17:55.000Z","updated_at":"2021-05-10T05:51:38.000Z","dependencies_parsed_at":"2023-02-08T03:35:13.131Z","dependency_job_id":null,"html_url":"https://github.com/yunsii/dva-base-models","commit_stats":{"total_commits":44,"total_committers":3,"mean_commits":"14.666666666666666","dds":"0.43181818181818177","last_synced_commit":"3e9bcb042a257ed565ca65fac544bb820ccd64e5"},"previous_names":["theprimone/dva-base-models"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yunsii%2Fdva-base-models","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yunsii%2Fdva-base-models/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yunsii%2Fdva-base-models/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yunsii%2Fdva-base-models/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/yunsii","download_url":"https://codeload.github.com/yunsii/dva-base-models/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240122610,"owners_count":19751145,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["curd","dva","model"],"created_at":"2024-11-09T01:31:07.180Z","updated_at":"2025-02-22T04:16:24.206Z","avatar_url":"https://github.com/yunsii.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# dva-base-models\n\n[![GitHub license](https://img.shields.io/github/license/theprimone/dva-base-models.svg)](https://github.com/theprimone/dva-base-models/blob/master/LICENSE)\n[![npm Version](https://img.shields.io/npm/v/dva-base-models.svg)](https://www.npmjs.com/package/dva-base-models)\n[![GitHub stars](https://img.shields.io/github/stars/theprimone/dva-base-models.svg)](https://github.com/theprimone/dva-base-models/stargazers)\n[![GitHub issues](https://img.shields.io/github/issues/theprimone/dva-base-models.svg)](https://github.com/theprimone/dva-base-models/issues)\n[![GitHub commit activity](https://img.shields.io/github/commit-activity/m/theprimone/dva-base-models.svg)](https://github.com/theprimone/dva-base-models/commits/master)\n\n\n基于 dva 的基础 model 配置\n\n## curdModel 增删改查 model\n\n### config\n\n| 参数 | 说明 | 类型 | 默认值 |\n| --- | --- | --- | --- |\n| getList | 配置如何从接口响应中得到数据列表和分页器 | (response) =\u003e ({ list: [], pagination: {} }) | - |\n| getData | 配置如何从接口响应中得到对象详情 | (response) =\u003e ({}) | - |\n| isResponseOk | 判断接口是否成功 | (response) =\u003e boolean | - |\n\n### set\n\n| 参数 | 说明 | 类型 | 默认值 |\n| --- | --- | --- | --- |\n| fetchMethod | 带查询参数的数据列表请求方法 | (paylaod) =\u003e Response | - |\n| isolatedGetList | 单独定义 model 的 getList | (Response) =\u003e data | - |\n| parallelFetchActions | 与查询并行的 action 列表 | string[] | [] |\n| afterFetchActions | 查询后需要回调的 action 列表 | string[] | [] |\n| detailMethod | 对象详情请求方法 | (id) =\u003e Response | - |\n| isolatedGetData | 单独定义 model 的 getData | (Response) =\u003e data | - |\n| parallelDetailActions | 与详情并行的 action 列表 | string[] | [] |\n| afterDetailActions | 详情后需要回调的 action 列表 | string[] | [] |\n| createMethod | 新建对象请求方法 | (paylaod) =\u003e Response | - |\n| afterCreateActions | 创建后需要回调的 action 列表 | string[] | [] |\n| updateMethod | 更新对象请求方法 | (id, paylaod) =\u003e Response | - |\n| afterUpdateActions | 更新后需要回调的 action 列表 | string[] | [] |\n| deleteMethod | 更新对象请求方法 | (id) =\u003e Response | - |\n| afterDeleteActions | 删除后需要回调的 action 列表 | string[] | [] |\n| extraState | 额外的 state ，可覆盖默认 state | {} | {} |\n| extraEffects | 额外的 effect ，可覆盖默认 effect | {} | {} |\n| extraReducers | 额外的 reducer ，可覆盖默认 reducer | {} | {} |\n\n### 使用方法\n\n* 配置 config ： `getList` 、 `getData` 、 `isResponseOk`\n* 配置 set ： `fetchMethod` 、 `detailMethod` 、 `createMethod` 、 `updateMethod` 、 `deleteMethod`\n\n具体使用参考 [Demo](https://github.com/zpr1g/ant-design-pro-plus/blob/v2/src/base-models/curd.ts) ，配置 `curdModel.config` 后导出 `curdModel.set` 。\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyunsii%2Fdva-base-models","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fyunsii%2Fdva-base-models","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyunsii%2Fdva-base-models/lists"}