From bfca8a885839a2d523178ef22cd112f46acc9eef Mon Sep 17 00:00:00 2001 From: fonghehe <331002675@qq.com> Date: Thu, 30 Apr 2026 19:46:33 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E4=BC=98=E5=8C=96=E6=95=B4=E4=BD=93?= =?UTF-8?q?=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .eslintrc-auto-import.json | 2 + README.md | 151 ++++++++++++++++++++++++++----- build/constant.ts | 4 + index.html | 7 +- mock/index.ts | 2 +- src/layout/index.vue | 14 +-- src/store/modules/user.ts | 13 +-- src/styles/variable.scss | 16 ++++ src/utils/request/index.ts | 26 ++++-- src/utils/request/useFetchApi.ts | 7 +- src/views/list/details/index.vue | 13 ++- 11 files changed, 200 insertions(+), 55 deletions(-) diff --git a/.eslintrc-auto-import.json b/.eslintrc-auto-import.json index 85f30ee..a41ec0c 100644 --- a/.eslintrc-auto-import.json +++ b/.eslintrc-auto-import.json @@ -16,6 +16,7 @@ "ShallowRef": true, "Slot": true, "Slots": true, + "Snackbar": true, "VNode": true, "WritableComputedRef": true, "acceptHMRUpdate": true, @@ -71,6 +72,7 @@ "shallowReactive": true, "shallowReadonly": true, "shallowRef": true, + "showToast": true, "storeToRefs": true, "toRaw": true, "toRef": true, diff --git a/README.md b/README.md index c81c48a..b6f3da5 100644 --- a/README.md +++ b/README.md @@ -1,40 +1,147 @@ -# vue-h5-template +
基于 Vue 3 + Vite 7 + TypeScript + 多 UI 组件库 + Pinia + viewport 适配方案,构建移动端快速开发脚手架
-基于 vue3 + vite + (nutui or varlet or vant) + ts + sass + viewport 适配方案 + axios 封装,构建手机端模板脚手架 +
+
+
+
+
-
+```bash
+# 拉取项目
+git clone https://github.com/sunniejs/vue-h5-template.git
+
+# 进入项目目录
+cd vue-h5-template
+
+# 安装依赖
+pnpm install
+
+# 启动项目
+pnpm dev
+
+# 打包
+pnpm build
+
+# 预览打包结果
+pnpm preview
+```
+
+## 项目结构
+
+```
+├── build/ # Vite 构建相关配置
+│ ├── vite/plugins/ # Vite 插件配置(auto-import、component、mock、eruda 等)
+│ └── utils.ts # 构建工具函数
+├── mock/ # Mock 数据
+├── public/ # 静态资源
+├── src/
+│ ├── api/ # 接口管理
+│ ├── assets/ # 项目资源(字体、图片等)
+│ ├── layout/ # 布局组件
+│ ├── locales/ # 国际化语言包
+│ ├── router/ # 路由配置
+│ ├── store/ # Pinia 状态管理
+│ ├── styles/ # 全局样式 & SCSS 变量
+│ ├── utils/ # 工具函数(Axios 封装、useFetch 封装)
+│ ├── views/ # 页面组件
+│ ├── App.vue # 根组件
+│ └── main.ts # 入口文件
+├── types/ # TypeScript 类型声明
+├── .env.* # 多环境变量配置
+├── vite.config.mts # Vite 配置
+├── postcss.config.js # PostCSS 配置(viewport 适配)
+├── Dockerfile # Docker 部署配置
+└── nginx.conf # Nginx 配置
+```
+
+## 集成的 Vite 插件
+
+| 插件 | 说明 |
+| ------------------------------- | -------------------- |
+| `unplugin-auto-import` | 按需自动引入 API |
+| `unplugin-vue-components` | 按需自动引入组件 |
+| `vite-plugin-pages` | 文件系统路由 |
+| `vite-plugin-mock` | 本地 Mock 数据 |
+| `@zhaojjiang/vite-plugin-eruda` | 移动端调试工具 |
+| `vite-plugin-svg-icons` | SVG 图标 |
+| `vite-plugin-compression` | Gzip 压缩 |
+| `vite-plugin-imagemin` | 图片压缩 |
+| `vite-plugin-pwa` | PWA 支持 |
+| `vite-plugin-qrcode` | 开发时二维码 |
+| `vite-plugin-restart` | 配置文件修改自动重启 |
+| `vite-plugin-progress` | 构建进度条 |
+| `@vitejs/plugin-basic-ssl` | 本地 HTTPS |
+| `rollup-plugin-visualizer` | 打包分析 |
+
+## 其他版本
+
+- **vue-h5-template-lite**(纯 JS 版)— [点击查看](https://github.com/sunniejs/vue-h5-template/tree/vue-h5-template-lite)
+- **vue2-h5-template**(Vue 2 版)— [点击查看](https://github.com/sunniejs/vue-h5-template/tree/vue2-h5-template)
+- **monorepo 版**(Monorepo 架构)— [点击查看](https://github.com/fonghehe/vue-h5-template)
+
+## 文档
+
+详细的使用文档请查看 [在线文档](https://sunniejs.github.io/vue-h5-template/)
+
+如果对你有帮助,欢迎 Star 支持 ⭐
+
+## 关于我
+
+扫描添加下方的微信并备注加交流群,交流学习,及时获取代码最新动态。
+
+
+
| WechatPay | -AliPay | +WechatPay | +AliPay |
![]() |
-
-
- |
+ ||
![]() |
+ ![]() |