--- name: dedsi-vue3-coding description: Vue 3 coding guidelines and best practices with Dedsi UI components --- # Dedsi Vue3 Coding Skills ## 1. 技术栈 (Technology Stack) - **Framework**: Vue 3 (Composition API) - **Language**: TypeScript - **UI Library**: Dedsi UI - Prefix: `dedsi-` (e.g., `dedsi-button`, `dedsi-table`) - **Icons**: `@ant-design/icons-vue` - **Date Handling**: `dayjs` - **HTTP Client**: Custom `AxiosRequest` wrapper ## 2. 项目结构 (Project Structure) - `src/apiServices/`: API 服务层,包含接口定义和 DTO 类型。 - `identitys/`: 身份认证相关服务 (User, Role, Permission 等)。 - `index.ts`: 导出所有服务。 - `types.ts`: 定义请求/响应接口 (DTO)。 - `src/views/`: 页面视图层。 - `user/index.vue`: 标准的 CURD 页面示例。 ## 3. 开发规范 (Development Guidelines) ### 3.1 API Service Layer - **位置**: `src/apiServices/{module}/` - **类定义**: 使用 class 定义 Service,内部实例化 `AxiosRequest`。 - **单例导出**: 导出 Service 的实例 (e.g., `export const userApiService = new UserApiService()`). - **类型定义**: DTO (Data Transfer Objects) 必须定义在同级或公共的 `types.ts` 中。 - **标准方法**: - `pagedQuery(data: InputDto)`: 分页查询 - `get(id: string)`: 获取详情 - `create(data: CreateResult)`: 创建 - `update(id: string, data: UpdateRequest)`: 更新 - `delete(id: string)`: 删除 **Example:** ```typescript export class UserApiService { private request = new AxiosRequest(IdentityApiServiceUrl) public pagedQuery(data: UserPagedInputDto) { return this.request.post('/api/Identity/User/PagedQuery', data) } } ``` ### 3.2 View Components 页面开发需遵循 Composition API (` ```