diff --git a/Yi.Vben5.Vue3/README.md b/Yi.Vben5.Vue3/README.md index 0ddad66e..5c32b30a 100644 --- a/Yi.Vben5.Vue3/README.md +++ b/Yi.Vben5.Vue3/README.md @@ -18,8 +18,51 @@ 该仓库使用vben5开发,采用分包目录结构, 具体开发路径为: `根目录/apps/web-antd` -**后端需要开启”furion格式的规范化api“**:路径在Yi.Abp.Net8/src/Yi.Abp.Web/YiAbpWebModule.cs +前端已同时兼容 **Furion 规范化 API 响应** 和 **ABP 风格响应**,可通过 `apps/web-antd/.env` 中的 `VITE_GLOB_API_STYLE` 配置响应风格:`auto`(默认)、`furion`、`abp`。 +如果使用 Furion 规范化响应,可在 `Yi.Abp.Net8/src/Yi.Abp.Web/YiAbpWebModule.cs` 中开启相关配置。 + +**Furion风格示例** + +````json +{ + "statusCode": 200, + "data": {"name": "大橙子","age": 20}, + "succeeded": true, + "errors": null, + "extras": null, + "timestamp": 1770825190 +} +```` +**ABP风格示例** + +````json +// 成功响应 +{ "name": "大橙子","age": 20} +```` +````json +// 异常响应 +{ + "error": { + "code": "string", + "message": "string", + "details": "string", + "data": { + "additionalProp1": "string", + "additionalProp2": "string", + "additionalProp3": "string" + }, + "validationErrors": [ + { + "message": "string", + "members": [ + "string" + ] + } + ] + } +} +````