Files
DDDMicroFrontend/doc/目录结构.md
2025-09-17 21:59:50 +08:00

44 lines
3.0 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

```txt
src/
├── domains/ # 【核心】领域层 - 所有业务领域模块
│ └── product/ # 订单领域模块
│ ├── domain/ # 领域模型(充血模型)
│ │ ├── entities/ # 实体(如:Product, ProductLineItem)
│ │ ├── value-objects/ # 值对象(如:Money, Address)
│ │ ├── types/ # 领域内通用类型
│ │ ├── enums/ # 领域枚举
│ │ └── events/ # 领域事件(如果需要)
│ ├── application/ # 应用服务层 - 协调领域对象完成用例
│ │ └── services/ # 应用服务(如:ProductApplicationService)
│ ├── infr/ # 基础设施层 - 领域层的具体实现
│ │ └── api/ # 数据获取实现(如:HttpProductRepository)
│ │ └── config/ # 请求接口地址的配置
│ ├── ports/ # 端口(接口/抽象类)- 定义契约
│ │ └── repositories/ # 仓储接口(如:ProductRepository)
│ └── use-cases/ # (可选)或将用例放在这里
├── app/ # 【交付层】应用组装和配置:路由、状态管理、主布局、UI库设置、错误处理、依赖注入容器
│ ├── components/ # 通用UI组件(与业务无关,如Button,Modal)
│ ├── layouts/ # 布局组件
│ ├── di/ # 依赖注入配置
│ ├── router/ # Vue Router 配置
│ ├── stores/ # Pinia Store(用于UI状态管理,非核心业务状态)
│ └── main.ts # 应用入口,依赖注入的组装之地
│ └── App.vue # 根组件
├── features/ # 【交付层】基于领域的功能模块:关注具体的业务功能实现,它是舞台上的“演员”和“节目”。
│ └── product/ # 订单功能模块
│ ├── components/ # 订单领域专用的UI组件
│ ├── views/ # 订单相关的页面级Vue组件
│ ├── router/ # 订单相关的页面级Vue组件
│ ├── composables/ # 订单相关的Vue组合式函数
│ └── index.ts # 订单功能模块的出口
├── shared/ # 共享资源
│ ├── infra(infrastructure) # 基础设施层
│ │ ├── http/
│ ├── lib/ # 第三方库的封装/工具函数
│ ├── utils/ # 纯工具函数
│ └── types/ # 全局通用的TypeScript类型定义
│ └── constants/ # 全局常量(如错误码、正则)
│ └── exceptions/ # 通用异常(如NotFoundError)
└── public/ # 静态资源目录
└── index.html # 主HTML文件
```