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:
23
AI-Coding/03-Mock-System.md
Normal file
23
AI-Coding/03-Mock-System.md
Normal file
@@ -0,0 +1,23 @@
|
||||
# 03. Mock 系统(开发联调与脱网演示)
|
||||
|
||||
## 挂载方式
|
||||
|
||||
- `vue.config.js`:`devServer.setupMiddlewares = require('./mock')`
|
||||
- `mock/index.js`:
|
||||
- 将路由集合转换为 express 形式
|
||||
- 使用 `mockjs` 返回数据
|
||||
- 监听 `mock/` 变更并热更新(`chokidar`)
|
||||
|
||||
## 路由定义约定(供 AI 生成/扩展)
|
||||
|
||||
在 `mock/controller/*.js` 中,每个路由对象通常包含:
|
||||
|
||||
- `url`:不含 `baseURL` 前缀的路径(中间件会自动拼上 `baseURL`)
|
||||
- `type`:`get` / `post` / ...
|
||||
- `response(req, res)`:返回对象或函数
|
||||
|
||||
## AI 新增业务 API 的推荐动作
|
||||
|
||||
1) 在 `src/api/<domain>.ts` 新增函数(调用 `request({ url, method })`)
|
||||
2) 在 `mock/controller/<domain>.js` 新增对应 mock 路由,路径保持一致
|
||||
3) 在模块规格中补充接口契约(建议写到 `openspec-lite/modules/<domain>.yaml`)
|
||||
Reference in New Issue
Block a user