baseHttpClient 代码完善 支持返回多种类型
This template should help get you started developing with Vue 3 in Vite.
VS Code + Vue (Official) (and disable Vetur).
.vue
TypeScript cannot handle type information for .vue imports by default, so we replace the tsc CLI with vue-tsc for type checking. In editors, we need Volar to make the TypeScript language service aware of .vue types.
tsc
vue-tsc
See Vite Configuration Reference.
npm install
npm run dev
npm run build
npm run lint
public # 暂定 dist #编译部署文件 src/ ├── components/ # 公共组件 │ ├── ui/ # 基础UI组件 │ ├── business/ # 业务组件 │ └── index.ts # 组件导出 ├── composables/ # 组合式函数 ├── views/ # 页面组件 ├── stores/ # 状态管理 ├── types/ # 类型定义 │ ├── api/ │ ├── business/ │ ├── component/ │ ├── common/ │ └── index.ts # 类型统一导出 ├── utils/ # 工具函数 ├── api/ # API 接口 ├── router/ # 路由配置 ├── assets/ # 静态资源 └── App.vue
组件文件:大驼峰 类型定义:大驼峰
工具函数/工具类:小驼峰 组合式函数:小驼峰 + “use” 前缀 Store/状态管理:小驼峰
api 定义规范 http
POST /api/v1/auth/login POST /api/v1/auth/refresh POST /api/v1/auth/logout POST /api/v1/auth/password-reset POST /api/v1/auth/mfa/verify
GET /api/v1/users POST /api/v1/users # 注册 GET /api/v1/users/{id} PUT /api/v1/users/{id} DELETE /api/v1/users/{id}
GET /api/v1/roles POST /api/v1/roles GET /api/v1/permissions
学习用
©Copyright 2023 CCF 开源发展委员会 Powered by Trustie& IntelliDE 京ICP备13000930号
vue-ts-demo
This template should help get you started developing with Vue 3 in Vite.
Recommended IDE Setup
VS Code + Vue (Official) (and disable Vetur).
Recommended Browser Setup
Type Support for
.vueImports in TSTypeScript cannot handle type information for
.vueimports by default, so we replace thetscCLI withvue-tscfor type checking. In editors, we need Volar to make the TypeScript language service aware of.vuetypes.Customize configuration
See Vite Configuration Reference.
Project Setup
Compile and Hot-Reload for Development
Type-Check, Compile and Minify for Production
Lint with ESLint
以下是项目结构
public # 暂定 dist #编译部署文件 src/ ├── components/ # 公共组件 │ ├── ui/ # 基础UI组件 │ ├── business/ # 业务组件 │ └── index.ts # 组件导出 ├── composables/ # 组合式函数 ├── views/ # 页面组件 ├── stores/ # 状态管理 ├── types/ # 类型定义 │ ├── api/ │ ├── business/ │ ├── component/ │ ├── common/ │ └── index.ts # 类型统一导出 ├── utils/ # 工具函数 ├── api/ # API 接口 ├── router/ # 路由配置 ├── assets/ # 静态资源 └── App.vue
命名规范
组件文件:大驼峰 类型定义:大驼峰
工具函数/工具类:小驼峰 组合式函数:小驼峰 + “use” 前缀 Store/状态管理:小驼峰
api 定义规范 http
认证授权
POST /api/v1/auth/login POST /api/v1/auth/refresh POST /api/v1/auth/logout POST /api/v1/auth/password-reset POST /api/v1/auth/mfa/verify
用户管理
GET /api/v1/users POST /api/v1/users # 注册 GET /api/v1/users/{id} PUT /api/v1/users/{id} DELETE /api/v1/users/{id}
权限管理
GET /api/v1/roles POST /api/v1/roles GET /api/v1/permissions