feat: 提交多个新UI组件模块spec和相关属性设定,包括卡片封装、渐变卡片、列式布局组件等,重写了readme.md,用于AI Coding
Some checks are pending
Call HTTPS API / build (push) Waiting to run
Some checks are pending
Call HTTPS API / build (push) Waiting to run
This commit is contained in:
17
AI-Coding/07-API.md
Normal file
17
AI-Coding/07-API.md
Normal file
@@ -0,0 +1,17 @@
|
||||
# 07. API 层(请求封装与域拆分)
|
||||
|
||||
- 示例:`src/api/router.ts` 调用 `request({ url: '/router/getList', method: 'get' })`
|
||||
- 请求封装:`src/utils/request.ts`(axios 拦截器、token 注入、401/402/403 处理、错误提示)
|
||||
- 刷新令牌:`src/api/refreshToken.ts`(402 时重试队列)
|
||||
- 请求异常入库:通过 `@vab/plugins/errorLog`(见 `library/plugins/errorLog.ts`)
|
||||
|
||||
## AI 复用原则
|
||||
|
||||
- 以“域”为单位抽取:`src/api/<domain>.ts`
|
||||
- 抽取前先定位 `request` 封装(通常在 `src/utils/request` 或相近位置)
|
||||
- 若新项目变更 baseURL/token/error 规范,优先在规格里声明差异,然后再做迁移适配
|
||||
|
||||
## 验收点
|
||||
|
||||
- 基础请求能发起
|
||||
- 错误处理与鉴权逻辑符合项目约束
|
||||
Reference in New Issue
Block a user