# miniapp-template **Repository Path**: ohmok/miniapp-template ## Basic Information - **Project Name**: miniapp-template - **Description**: 基于 uni-app + Vue 3 + Vite + TypeScript + uView Plus 的跨平台项目模板,支持微信小程序、支付宝小程序、小红书小程序、H5 等多端构建。 - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 3 - **Forks**: 1 - **Created**: 2025-05-06 - **Last Updated**: 2026-03-06 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # uni-preset-vue 基于 [uni-app](https://uniapp.dcloud.net.cn/) + [Vue 3](https://cn.vuejs.org/) + [Vite](https://vitejs.dev/) + [TypeScript](https://www.typescriptlang.org/) + [uView Plus](https://www.uviewui.com/) 的跨平台项目模板,支持微信小程序、支付宝小程序、小红书小程序、H5 等多端构建。 ## 📦 项目依赖 - `vue@3.4.21` - `pinia` 状态管理 - `uview-plus` UI 组件库 - `vite@5.2.8` 前端构建工具 - `typescript@4.9.4` - 多端编译插件(如 `@dcloudio/uni-mp-weixin`、`uni-mp-xhs` 等) ## 🧩 功能特性 - 多端小程序支持(微信 / 支付宝 / 小红书) - SCSS 预处理支持(已内置 `sass` 和 `sass-loader`) - 多语言国际化支持(`vue-i18n`) - 构建前自动清理缓存 (`rimraf dist`) - 完善的类型检查 (`vue-tsc`) ## 🚀 启动与构建 ### 安装依赖 ```bash npm install ``` ### 开发命令 | 平台 | 命令 | | -------- | ------------------------------ | | 自定义平台 | `npm run dev:custom` | | H5 | `npm run dev:h5` | | 微信小程序 | `npm run dev:mp-weixin` | | 支付宝小程序 | `npm run dev:mp-alipay` | | 小红书小程序 | `npm run dev:mp-xhs` | | 快应用 (通用) | `npm run dev:quickapp-webview` | > 每次运行会自动清除旧的构建目录 `dist` ### 构建命令 | 平台 | 命令 | | ------ | ------------------------- | | H5 构建 | `npm run build:h5` | | 微信小程序 | `npm run build:mp-weixin` | | 支付宝小程序 | `npm run build:mp-alipay` | | 小红书小程序 | `npm run build:mp-xhs` | ### 类型检查 ```bash npm run type-check ``` ## 📁 项目结构简述 ``` ├── dist/ # 构建输出目录 ├── src/ │ ├── api/ # 接口封装 │ ├── components/ # 公共组件 │ ├── pages/ # 页面目录 │ ├── static/ # 静态资源 │ ├── stores/ # Pinia 状态管理 │ ├── types/ # 类型定义 │ ├── utils/ # 工具函数 │ ├── App.vue # 入口组件 │ ├── env.d.ts # 环境类型定义 │ ├── main.ts # 应用初始化入口 │ ├── manifest.json # uni-app 配置 │ ├── pages.json # 页面配置 │ ├── shime-uni.d.ts # uni 全局类型声明 │ └── uni.scss # 全局样式文件 ├── .gitignore ├── index.html ├── package.json ├── shims-uni.d.ts ├── tsconfig.json ├── vite.config.ts ``` ## 🧩 注意事项 * 如果 TS 报 `Could not find a declaration for 'uview-plus'`,请在 `types/module.d.ts` 添加以下声明: ```ts declare module 'uview-plus' { const uviewPlus: any; export default uviewPlus; } ``` * 若 WebStorm 报错,请使用 `File > Invalidate Caches / Restart` 清理缓存。