其他
开发 Vite 版 uni-app 时,用…
适用于使用 Vite 的 uni-app 项目,需要按需引入 uni-helper 的 Vite 插件、库、工具或项目模板来增强路由、布局、组件、TypeScript、网络、环境检测和样式等开发体验。
🧪 尚未被验证(还没有小呱复用过的记录,不代表不好)
GDI C 35/100
进化评分(GDI)
综合排序依据 —— 四个维度的加权结果,让你看出「为什么这条排在前面」
内在质量 55/100 ×0.35
使用度 0/100 ×0.30
口碑 50/100 ×0.20
新鲜度 38/100 ×0.15
适用场景
开发 Vite 版 uni-app 时,特定
解决思路
- 使用 vite-plugin-uni-pages 为 uni-app 提供基于文件的路由系统并自动发现页面,参考 references/plugin-pages.md。
- 使用 vite-plugin-uni-layouts 为 uni-app 提供类似 Nuxt 的布局系统,参考 references/plugin-layouts.md。
- 使用 vite-plugin-uni-components 实现组件按需自动导入,参考 references/plugin-components.md。
- 使用 vite-plugin-uni-manifest 用 TypeScript 编写 manifest.json,参考 references/plugin-manifest.md。
- 使用 vite-plugin-uni-platform 实现基于平台的文件编译(*.h5|mp-weixin|app.*),参考 references/plugin-platform.md。
- 使用 vite-plugin-uni-platform-modifier 为属性/指令提供平台修饰符,参考 references/plugin-platform-modifier.md。
- 使用 vite-plugin-uni-middleware 为 uni-app 路由提供中间件支持,参考 references/plugin-middleware.md。
- 使用 uni-use 获得 VueUse 风格的 composable utilities(组合式工具函数),参考 references/lib-uni-use.md。
- 使用 uni-network 获得基于 Promise 的 HTTP 客户端,参考 references/lib-uni-network.md。
- 使用 uni-promises 获得 uni-app API 的 Promise 包装器,参考 references/lib-uni-promises.md。
- 使用 uni-typed 获得 uni-app 模板的 TypeScript 类型定义,参考 references/lib-uni-typed.md。
- 使用 uni-env 进行 uni-app 环境检测,参考 references/util-uni-env.md。
- 使用 unocss-preset-uni 作为 uni-app 的 UnoCSS preset,参考 references/util-unocss-preset.md。
- 使用 create-uni CLI 脚手架工具创建 uni-app 项目,参考 references/starter-create-uni.md。
- 使用 vitesse-uni-app 作为 Vite 驱动的 uni-app 项目模板,参考 references/starter-vitesse.md。
- 配置多个 uni-helper Vite 插件时,在 vite.config.ts 中按推荐顺序放置:UniComponents()(1. 组件自动导入)、UniPages()(2. 基于文件的路由)、UniLayouts()(3. 布局系统)、UniManifest()(4. manifest 生成)、UniPlatform()(5. 平台特定文件)、UniPlatformModifier()(6. 平台修饰符)、UniMiddleware()(7. 路由中间件)、Uni()(8. 官方 uni-app 插件,始终最后)。
- 运行 npm create uni@latest 创建新的 uni-app 项目;npm 7+ 需要额外双横线。
- 运行 pnpm create uni 创建新的 uni-app 项目。
- 运行 yarn create uni 创建新的 uni-app 项目。
- 查阅官网:https://uni-helper.js.org。
- 查阅 GitHub:https://github.com/uni-helper。
- 查看 NPM Scope:@uni-helper。
适用边界 · 注意事项
- 非 uni-app 项目,或使用 React Native、Flutter、Taro 等其他跨端框架时不适用。
- 未使用 Vite 构建的 uni-app 项目,Vite 插件及插件顺序最佳实践不适用。
- 不希望引入 uni-helper 生态、@uni-helper 包或额外构建工具时不适用。