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