# 前端通用模板 **Repository Path**: hanser_wei_admin/front-end-universal-template ## Basic Information - **Project Name**: 前端通用模板 - **Description**: 提供前端开发基础框架与于接口生成工具,支持快速搭建Web应用,涵盖多种布局与交互效果,助力开发者高效实现项目目标。 - **Primary Language**: Unknown - **License**: MIT - **Default Branch**: main - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2025-09-25 - **Last Updated**: 2025-09-25 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # New Community Frontend Project This project is a modern frontend template based on Vue 3, Vite, TypeScript, and Pinia. ## ✨ Features * **Tech Stack**: Vue 3, Vite, TypeScript, Pinia * **UI Framework**: (Please fill in your UI framework here, e.g., Element Plus, Naive UI) * **Code Standards**: Prettier, ESLint * **HTTP Requests**: Axios * **API Code Generation**: Orval ## 🚀 Quick Start 1. **Install Dependencies** ```bash pnpm install ``` 2. **Start Development Server** ```bash pnpm dev ``` 3. **Build for Production** ```bash pnpm build ``` ## 📂 Directory Structure ``` . ├── public/ # Static assets directory ├── src/ │ ├── api/ # Orval auto-generated API code │ │ ├── *-controller/ # API files split by backend controllers (tags) │ │ └── models/ # Backend response data structures (DTOs/VOs) │ ├── router/ # Router configuration │ ├── stores/ # Pinia state management │ ├── App.vue # Root component │ ├── main.ts # Application entry file │ └── axios-instance.ts# Custom Axios instance ├── .env.development # Development environment variables ├── .env.production # Production environment variables ├── eslint.config.ts # ESLint configuration file ├── orval.config.ts # Orval configuration file ├── package.json # Project dependencies and scripts └── tsconfig.json # TypeScript configuration file ``` ## 💡 API Interface Guide This project uses [Orval](https://orval.dev/) to automatically generate type-safe API request code based on the backend OpenAPI specification. All API-related files are located in the `src/api` directory. ### How to Use APIs are grouped according to backend controllers, for example, interfaces related to `user-controller` are located in `src/api/user-controller/user-controller.ts`. Since we have configured a custom Axios instance, the response interceptor will automatically parse and return `response.data`. Therefore, the data returned from API calls is already the actual data body from the backend, and there's no need to extract `.data`. **Example: Fetching the User List** Suppose we need to call the `listUserByPage` interface from the `user-controller` to fetch a paginated list of users. ```typescript ``` ### Updating the API When backend APIs change, you may need to regenerate the API code. Typically, you can configure a script in `package.json` to do this (if not already configured). ```bash # Assuming "generate:api": "orval" is configured in package.json pnpm generate:api ```