mirror of
https://gitee.com/h_mo/uniapp-vue3-vite-ts-template
synced 2025-04-05 06:12:44 +08:00
commit
c0d7e9bb65
4
.npmrc
4
.npmrc
@ -2,5 +2,5 @@
|
||||
# 提示:如果你不希望pnpm在对等依赖问题上失败,在项目根目录下的.npmrc文件中添加"strict-peer-dependencies=false"。
|
||||
# auto-install-peers=true
|
||||
strict-peer-dependencies=false
|
||||
# registry=https://registry.npmmirror.com
|
||||
registry=https://registry.npmjs.org
|
||||
registry=https://registry.npmmirror.com
|
||||
# registry=https://registry.npmjs.org
|
||||
|
16
.versionrc
Normal file
16
.versionrc
Normal file
@ -0,0 +1,16 @@
|
||||
{
|
||||
"types": [
|
||||
{"type": "chore", "section":"'🎫 Chores | 其他更新", "hidden": false},
|
||||
{"type": "revert", "section":"⏪ Reverts | 回退", "hidden": false},
|
||||
{"type": "feat", "section": "✨ Features | 新功能", "hidden": false},
|
||||
{"type": "fix", "section": "🐛 Bug Fixes | Bug 修复", "hidden": false},
|
||||
{"type": "improvement", "section": "Feature Improvements", "hidden": false},
|
||||
{"type": "docs", "section":"📝 Documentation | 文档", "hidden": false},
|
||||
{"type": "style", "section":"💄 Styles | 风格", "hidden": false},
|
||||
{"type": "refactor", "section":"💄 Refactor | 重构", "hidden": false},
|
||||
{"type": "perf", "section":"⚡ Performance Improvements | 性能优化", "hidden": false},
|
||||
{"type": "test", "section":"✅ Tests | 测试", "hidden": false},
|
||||
{"type": "build", "section":"👷 Build System | 构建", "hidden": false},
|
||||
{"type": "ci", "section":"🔧 Continuous Integration | CI 配置", "hidden":false}
|
||||
]
|
||||
}
|
166
CHANGELOG.md
Normal file
166
CHANGELOG.md
Normal file
@ -0,0 +1,166 @@
|
||||
# Changelog
|
||||
|
||||
All notable changes to this project will be documented in this file. See [commit-and-tag-version](https://github.com/absolute-version/commit-and-tag-version) for commit guidelines.
|
||||
|
||||
## 2.0.0 (2024-08-20)
|
||||
|
||||
|
||||
### '🎫 Chores | 其他更新
|
||||
|
||||
* 更新 uni-mini-router 修复前置导航守卫无法指向跳转类型不同的页面的问题 ([bee039b](https://gitee.com/h_mo/uniapp-vue3-vite-ts-template/commit/bee039b624a1338b2db6c1db8e3ae7627c50a69c))
|
||||
* 更新 uni-mini-router 修复未配置导航守卫时无法跳转的问题 ([b13d993](https://gitee.com/h_mo/uniapp-vue3-vite-ts-template/commit/b13d9935a3ce4394868a80d09f0dfafa14927bf0))
|
||||
* 更新 uniapp 到 3.6.17 20230111001 ([cbec132](https://gitee.com/h_mo/uniapp-vue3-vite-ts-template/commit/cbec1323b9cb763bc4b57d7e608ac3414e5aee95))
|
||||
* 更新部分依赖 ([cd96923](https://gitee.com/h_mo/uniapp-vue3-vite-ts-template/commit/cd96923d779d336d59f47369772b2ec93b072b6f))
|
||||
* 更新依赖 ([776d99a](https://gitee.com/h_mo/uniapp-vue3-vite-ts-template/commit/776d99a69b39581b308066781fe72395584aa22d))
|
||||
* 更新依赖 ([4bd19e6](https://gitee.com/h_mo/uniapp-vue3-vite-ts-template/commit/4bd19e674b7df7aed873ebdb1a0a72641b6469d1))
|
||||
* 更新依赖 ([fa112f8](https://gitee.com/h_mo/uniapp-vue3-vite-ts-template/commit/fa112f88b9ecc22acdb27a9c89af4ea05da01775))
|
||||
* 更新依赖 ([e0d9972](https://gitee.com/h_mo/uniapp-vue3-vite-ts-template/commit/e0d997237da34de0bddbfdb8a227c017f74488c0))
|
||||
* 更新依赖 ([4d542ec](https://gitee.com/h_mo/uniapp-vue3-vite-ts-template/commit/4d542ecd59dd6a7d393b06c012fbc2d368a2968f))
|
||||
* 更新依赖 ([9fdd969](https://gitee.com/h_mo/uniapp-vue3-vite-ts-template/commit/9fdd96921357ba85eb6cca7a49d623d53b94c32b))
|
||||
* 更新依赖 ([0307f7f](https://gitee.com/h_mo/uniapp-vue3-vite-ts-template/commit/0307f7fdca809a88fd0f7006f860535ae5821641))
|
||||
* 更新依赖 ([c93b7b1](https://gitee.com/h_mo/uniapp-vue3-vite-ts-template/commit/c93b7b1df0bfa15721b3786931693d68d7ea8f1c))
|
||||
* 更新依赖 ([9837129](https://gitee.com/h_mo/uniapp-vue3-vite-ts-template/commit/983712947194e57fe7decf631e5d08be751e81b2))
|
||||
* 更新依赖 ([a9721bf](https://gitee.com/h_mo/uniapp-vue3-vite-ts-template/commit/a9721bfdaf119f206626be39d8203d5eab68c69c))
|
||||
* 更新依赖 ([43b8920](https://gitee.com/h_mo/uniapp-vue3-vite-ts-template/commit/43b8920e741a1c59108c3b0fdcd1931ff9473e07))
|
||||
* 更新依赖 ([10df991](https://gitee.com/h_mo/uniapp-vue3-vite-ts-template/commit/10df991487b67556a2d6a71d78064001a2bcddd7))
|
||||
* 更新依赖 ([6f0e877](https://gitee.com/h_mo/uniapp-vue3-vite-ts-template/commit/6f0e8778f341bcbce3f72f45a2f11558e97dcfd1))
|
||||
* 更新依赖 ([be1c341](https://gitee.com/h_mo/uniapp-vue3-vite-ts-template/commit/be1c3414415beb2b1ecbd5aab213fe3b2564695c))
|
||||
* 更新依赖 ([5710ae1](https://gitee.com/h_mo/uniapp-vue3-vite-ts-template/commit/5710ae16ee3b0f5746533e19e0096bebca190d1d))
|
||||
* 更新依赖 ([347d023](https://gitee.com/h_mo/uniapp-vue3-vite-ts-template/commit/347d0233c4f1049362fc161af701165af605ea6d))
|
||||
* 更新依赖 ([dd506ce](https://gitee.com/h_mo/uniapp-vue3-vite-ts-template/commit/dd506ce576002edee417ae44064392202b34f791))
|
||||
* 更新依赖 ([3ba0463](https://gitee.com/h_mo/uniapp-vue3-vite-ts-template/commit/3ba04639505817b2326284cfbc462a70cd12077d))
|
||||
* 更新依赖 ([3299533](https://gitee.com/h_mo/uniapp-vue3-vite-ts-template/commit/3299533e3123694d8db3e71cba3f8dae681da1bc))
|
||||
* 更新依赖 ([8a4cd75](https://gitee.com/h_mo/uniapp-vue3-vite-ts-template/commit/8a4cd75b4f8cd69a79f880b072c758b817a92bcc))
|
||||
* 更新依赖 ([28a7ec0](https://gitee.com/h_mo/uniapp-vue3-vite-ts-template/commit/28a7ec0dc2b5e0190a942a0e3e2e84c42902c4ae))
|
||||
* 移除未用依赖-qs ([16e230b](https://gitee.com/h_mo/uniapp-vue3-vite-ts-template/commit/16e230baadaaee46ad2aba47270b0092ab431e96))
|
||||
* 优化配置 ([5ddc086](https://gitee.com/h_mo/uniapp-vue3-vite-ts-template/commit/5ddc086f96c56c675e498961e81c5988704da23c))
|
||||
* **deps:** 更新依赖版本,提升安全性和稳定性 ([0ceb22c](https://gitee.com/h_mo/uniapp-vue3-vite-ts-template/commit/0ceb22cca9875b695d91fc357e72e833651e5c4b))
|
||||
* **deps:** 更新依赖版本,提升安全性和稳定性 ([b84074d](https://gitee.com/h_mo/uniapp-vue3-vite-ts-template/commit/b84074d5a4820aa42e80b09e6ebc7cb34aa54711))
|
||||
* **deps:** 更新依赖版本,提升安全性和稳定性 ([1a9d4b9](https://gitee.com/h_mo/uniapp-vue3-vite-ts-template/commit/1a9d4b91813cea900210cc4f799abdb84047b729))
|
||||
* **deps:** 依赖更新和registry更改 ([626781e](https://gitee.com/h_mo/uniapp-vue3-vite-ts-template/commit/626781e26a96d02b40316d356361e2c94d400da7))
|
||||
* git忽略 ([e5f330d](https://gitee.com/h_mo/uniapp-vue3-vite-ts-template/commit/e5f330d954640622960f43b996a51f54092e17ba))
|
||||
* git忽略.vscode ([d152a08](https://gitee.com/h_mo/uniapp-vue3-vite-ts-template/commit/d152a08c8db7d1723c761b24393bf023251c7c44))
|
||||
* v1.1.0 ([b44722b](https://gitee.com/h_mo/uniapp-vue3-vite-ts-template/commit/b44722b4755f8f8fb903b20523e04ad853dc283f))
|
||||
* v1.1.2 ([5bae0db](https://gitee.com/h_mo/uniapp-vue3-vite-ts-template/commit/5bae0db521a8e6f81c75ba8396adda0410d911b0))
|
||||
* v1.2.0 ([6fa79a3](https://gitee.com/h_mo/uniapp-vue3-vite-ts-template/commit/6fa79a3172b7c845a48988134e0b672acbb5ec40))
|
||||
* v1.2.1 ([a3c4670](https://gitee.com/h_mo/uniapp-vue3-vite-ts-template/commit/a3c4670487c054c56fd2105b803308afe352b9fa))
|
||||
* v1.3.0 ([ac0adea](https://gitee.com/h_mo/uniapp-vue3-vite-ts-template/commit/ac0adea64a83d0fe17808cfddf2089838cc4cf3b))
|
||||
* v1.3.1 ([9a50a8a](https://gitee.com/h_mo/uniapp-vue3-vite-ts-template/commit/9a50a8a518e3992227fe8f3f4295e114ef562a66))
|
||||
|
||||
|
||||
### ✨ Features | 新功能
|
||||
|
||||
* 当前platform(平台) ([3a83e5b](https://gitee.com/h_mo/uniapp-vue3-vite-ts-template/commit/3a83e5b4fbcc9a4eb566873ce0bd7b9e27f7b530))
|
||||
* 改用alova请求 ([bb83550](https://gitee.com/h_mo/uniapp-vue3-vite-ts-template/commit/bb83550fe19867dfc7c9843068ec6b6676ab9e29))
|
||||
* 兼容多端统一配置BASE_URL环境变量 ([6ca18b4](https://gitee.com/h_mo/uniapp-vue3-vite-ts-template/commit/6ca18b4bc2af917e9484ed3fcb1c3ad30c24eaa3))
|
||||
* 使用uni-mini-router路由管理 ([71c0de1](https://gitee.com/h_mo/uniapp-vue3-vite-ts-template/commit/71c0de151c85c8885952abecffcf6948aa7dcaec))
|
||||
* 完善部分代码 ([862ee17](https://gitee.com/h_mo/uniapp-vue3-vite-ts-template/commit/862ee17c88b187812575ee73da727f2ce0d803bd))
|
||||
* 完善FontAwesomeIcon demo ([7b9a1e8](https://gitee.com/h_mo/uniapp-vue3-vite-ts-template/commit/7b9a1e81f2710a56d6961cd18721fc41136741d9))
|
||||
* 完整显示图标 ([b60f7fa](https://gitee.com/h_mo/uniapp-vue3-vite-ts-template/commit/b60f7fa728ec9e833c03cf8a41c51a9469d1fc2a))
|
||||
* 新增 VITE_USE_MOCK 配置 ([ac3b3ad](https://gitee.com/h_mo/uniapp-vue3-vite-ts-template/commit/ac3b3adec77e1af020dab4dfd4ceb02b894d8745))
|
||||
* 新增[unplugin-auto-import] 自动导入 ([26f1911](https://gitee.com/h_mo/uniapp-vue3-vite-ts-template/commit/26f1911ff284176abc4ce08c9dc024ac15bd4a04))
|
||||
* 新增设置系统剪贴板的内容工具函数 ([b7ccd95](https://gitee.com/h_mo/uniapp-vue3-vite-ts-template/commit/b7ccd95e9b7be90ccc8992bd14c34eaedc7c162e))
|
||||
* 引入 `uni-vue-devtools`,并配置 `dev:mp-weixin` 自动启动 ([fd44193](https://gitee.com/h_mo/uniapp-vue3-vite-ts-template/commit/fd4419389491c6bb1efbea32e0cb3ffd07e8a5c2))
|
||||
* 在生产环境中排除 mock 数据 ([0598f3a](https://gitee.com/h_mo/uniapp-vue3-vite-ts-template/commit/0598f3a09def3bf3d1dd6e7076c929c631df7fcc))
|
||||
* 增加 iconify 组件,可任意使用全网图标 ([f6b06d5](https://gitee.com/h_mo/uniapp-vue3-vite-ts-template/commit/f6b06d5a612c181046384e3bb15e390c0d342504))
|
||||
* 增加commitlint提交方式 ([ec1d011](https://gitee.com/h_mo/uniapp-vue3-vite-ts-template/commit/ec1d011a7788184e45740e7f2453aa68be4580c9))
|
||||
* Added utility function - judgePlatform ([e28a64a](https://gitee.com/h_mo/uniapp-vue3-vite-ts-template/commit/e28a64a6939583695722a6dffcd22660625c1069))
|
||||
* duotone图标样式配置 ([998c87f](https://gitee.com/h_mo/uniapp-vue3-vite-ts-template/commit/998c87fa76e96a00bb60477546b702cefc4c6438))
|
||||
* FontAwesomeIcon ([89a695f](https://gitee.com/h_mo/uniapp-vue3-vite-ts-template/commit/89a695fbde7ebc79c0ba57c6cb84376c84d55db0))
|
||||
* FontAwesomeIcon 兼容性 ([3a331d7](https://gitee.com/h_mo/uniapp-vue3-vite-ts-template/commit/3a331d73e30bc9db23892cf98515b03e08f56cc5))
|
||||
* FontAwesomeIcon click emit ([f8866ec](https://gitee.com/h_mo/uniapp-vue3-vite-ts-template/commit/f8866ece2a741819b16c3f4448d4ae18f2db7909))
|
||||
* FontAwesomeIcon counter ([6de5d36](https://gitee.com/h_mo/uniapp-vue3-vite-ts-template/commit/6de5d36126c49fbab5c508b146050feabce69fcf))
|
||||
* FontAwesomeIcon demo example ([460387c](https://gitee.com/h_mo/uniapp-vue3-vite-ts-template/commit/460387ca9329d5c8da27b9c3ca839f5a116eacd3))
|
||||
* FontAwesomeIcon stack example ([e587fb5](https://gitee.com/h_mo/uniapp-vue3-vite-ts-template/commit/e587fb5be6c9ff73603442f7994e69bc13c3a3cc))
|
||||
* mock数据 ([a7c3606](https://gitee.com/h_mo/uniapp-vue3-vite-ts-template/commit/a7c36064f58f4b618d1c699d0f1c939759dde63e))
|
||||
* **readme:** 更新 Vite 和 ESLint 版本号,调整测试通过平台说明 ([51dc1e6](https://gitee.com/h_mo/uniapp-vue3-vite-ts-template/commit/51dc1e69dbaf58bd233c7c259a6a0a5cc1ef04ca))
|
||||
* **release:** 添加版本发布脚本和更新类型定义 ([cf2cadd](https://gitee.com/h_mo/uniapp-vue3-vite-ts-template/commit/cf2caddefb9b27dcc9f368a5919f0193eb23c2ad))
|
||||
* tabBar页面登录优化 ([825db53](https://gitee.com/h_mo/uniapp-vue3-vite-ts-template/commit/825db5362af05a56c3aecf1b8f4ac9de5542d4a7))
|
||||
* tabBar页面登录优化 ([62d62ed](https://gitee.com/h_mo/uniapp-vue3-vite-ts-template/commit/62d62ede02d2cf40ef11b4613b6324754d7957e2))
|
||||
* useRoute and useRouter Hook ([b672549](https://gitee.com/h_mo/uniapp-vue3-vite-ts-template/commit/b672549cff08a63e491f987dd5e0e601ef9de2e4))
|
||||
* **vite-config:** 添加页面配置文件至重启监听列表 ([1e7a1cc](https://gitee.com/h_mo/uniapp-vue3-vite-ts-template/commit/1e7a1cc371d14b99bb510fe260fd24b25756c685))
|
||||
|
||||
|
||||
### 🐛 Bug Fixes | Bug 修复
|
||||
|
||||
* [H5]:运行环境判断错误 ([0b3f560](https://gitee.com/h_mo/uniapp-vue3-vite-ts-template/commit/0b3f5601c85eecb2f2a76a805421242bc0523014))
|
||||
* 导入 'uni-mini-router' 类型不正确问题 ([f997a9d](https://gitee.com/h_mo/uniapp-vue3-vite-ts-template/commit/f997a9d6c1312b10f69d56cd4708b8625ea174b0))
|
||||
* 忽略 *.local 本地配置文件 ([58b83be](https://gitee.com/h_mo/uniapp-vue3-vite-ts-template/commit/58b83be0af122a5bc8be0cfd93f228310b6f6dd8))
|
||||
* 解决无模块 'uview-plus' 问题,并扩展 uni.$u 类型支持 ([0a0f4ce](https://gitee.com/h_mo/uniapp-vue3-vite-ts-template/commit/0a0f4cea13fa83e217a79adc7f34dda620da7662))
|
||||
* 开发环境 h5 代理配置 ([8cc0fc9](https://gitee.com/h_mo/uniapp-vue3-vite-ts-template/commit/8cc0fc91f41f27912c33dedcb3e444f389c2ce65))
|
||||
* 修复 eslint 扁平化配置错误 ([b26db07](https://gitee.com/h_mo/uniapp-vue3-vite-ts-template/commit/b26db07d1b8dae25c70cd6370ffcb3314093b725))
|
||||
* 修复没有正确配置 eslint 扁平化配置的问题 ([81d1b6c](https://gitee.com/h_mo/uniapp-vue3-vite-ts-template/commit/81d1b6c707f498d5bb93f73b3d6a1484e54d2703))
|
||||
* 修复跳转到登录页面传参错误 ([b5f7e31](https://gitee.com/h_mo/uniapp-vue3-vite-ts-template/commit/b5f7e31b706cf7cc2b0694cf2e0d5ff63ae7ca5e))
|
||||
* 修复文件路径大小写手误告警 ([9748797](https://gitee.com/h_mo/uniapp-vue3-vite-ts-template/commit/97487974c2cc2058779fb7a5824b158e7b600da7))
|
||||
* 修复在小程序中获取当前平台使用 process.env['UNI_PLATFORM'] 无效问题 ([ff4b1f9](https://gitee.com/h_mo/uniapp-vue3-vite-ts-template/commit/ff4b1f9278ffa5ff31a1aee278bf2404c3f190ba))
|
||||
* 修改 AppProvider 组件的文件名为 index.vue ([6cad0d4](https://gitee.com/h_mo/uniapp-vue3-vite-ts-template/commit/6cad0d4370b1cde33b867dc9b88bba1e443eb28b))
|
||||
* 移除无关项 ([e3c3759](https://gitee.com/h_mo/uniapp-vue3-vite-ts-template/commit/e3c375954804344bc983962f0a28b157c16ef917))
|
||||
* 移动 env.d.ts 到 types 目录 ([03bc0d8](https://gitee.com/h_mo/uniapp-vue3-vite-ts-template/commit/03bc0d8b22523221101397121f5bc9f7f9017545))
|
||||
|
||||
|
||||
### 📝 Documentation | 文档
|
||||
|
||||
* 小程序体验码 ([19dde05](https://gitee.com/h_mo/uniapp-vue3-vite-ts-template/commit/19dde05e04498cea60e1274b86dc2f817e30f392))
|
||||
* **readme:** 更新徽标和环境配置说明 ([d734c04](https://gitee.com/h_mo/uniapp-vue3-vite-ts-template/commit/d734c0409fe2e4c2861db416797298779fd13b50))
|
||||
* update README.md ([eb285ef](https://gitee.com/h_mo/uniapp-vue3-vite-ts-template/commit/eb285ef5358e7b53728a33bb11d46584572dfb26))
|
||||
* update README.md ([00d3ac1](https://gitee.com/h_mo/uniapp-vue3-vite-ts-template/commit/00d3ac139d3f42d086f36806961e67e92d418ceb))
|
||||
* update README.md ([cbdea39](https://gitee.com/h_mo/uniapp-vue3-vite-ts-template/commit/cbdea39dad48341a6572cd460777c264e56b2c3d))
|
||||
* update README.md ([98afa46](https://gitee.com/h_mo/uniapp-vue3-vite-ts-template/commit/98afa46b592cbd1618aecfe0dad418bb249def7a))
|
||||
* update README.md ([c39c893](https://gitee.com/h_mo/uniapp-vue3-vite-ts-template/commit/c39c89371ed14dc683f10d4d9bed7f91f3e9f79c))
|
||||
* update README.md ([2116e71](https://gitee.com/h_mo/uniapp-vue3-vite-ts-template/commit/2116e71e4b06d958e22a992f4eb6c4e4c3fb3418))
|
||||
* update README.md ([71dc6a3](https://gitee.com/h_mo/uniapp-vue3-vite-ts-template/commit/71dc6a33741474cade8466f7b834eefcb2cccb32))
|
||||
* update README.md ([e8c56cf](https://gitee.com/h_mo/uniapp-vue3-vite-ts-template/commit/e8c56cf06d78c76ef0203fffd07547cd556194c4))
|
||||
* update README.md ([4ca0e9d](https://gitee.com/h_mo/uniapp-vue3-vite-ts-template/commit/4ca0e9d1fe74cb2007dacca5efc463afda2852f6))
|
||||
* update README.md ([917f1bb](https://gitee.com/h_mo/uniapp-vue3-vite-ts-template/commit/917f1bb45220bd53dfe5bf42cc9cd6b952e3b403))
|
||||
* update README.md ([8fe8fa0](https://gitee.com/h_mo/uniapp-vue3-vite-ts-template/commit/8fe8fa0b95cb369830a59be0edd26a92d8550a58))
|
||||
* update README.md ([e970b54](https://gitee.com/h_mo/uniapp-vue3-vite-ts-template/commit/e970b547182539ffcb3036baa4372720b9bae817))
|
||||
* update README.md ([d8bb344](https://gitee.com/h_mo/uniapp-vue3-vite-ts-template/commit/d8bb34420b0ca363c4b5cba2f631863f21f4a9c6))
|
||||
* update README.md. ([cd2da6a](https://gitee.com/h_mo/uniapp-vue3-vite-ts-template/commit/cd2da6a4bf2adba0514623ffdd5aba88a884133a))
|
||||
|
||||
|
||||
### 💄 Styles | 风格
|
||||
|
||||
* 格式化 ([002325b](https://gitee.com/h_mo/uniapp-vue3-vite-ts-template/commit/002325bfbb5a24eb9cc94364c748451fe1aaff60))
|
||||
* 更改cache文件夹名 ([4d62958](https://gitee.com/h_mo/uniapp-vue3-vite-ts-template/commit/4d62958316a7895d4492f0d991f746aacd8935a5))
|
||||
* 换行改为CRLF ([7e141b6](https://gitee.com/h_mo/uniapp-vue3-vite-ts-template/commit/7e141b6e54ed976257224d903ed5db04c1edd1fb))
|
||||
* 优化路由跳转 ([f7a5f35](https://gitee.com/h_mo/uniapp-vue3-vite-ts-template/commit/f7a5f350f7b9dd54ab9e478d2fa5f68e8d414a0f))
|
||||
* 优化路由跳转 ([43786d6](https://gitee.com/h_mo/uniapp-vue3-vite-ts-template/commit/43786d6672dda47c6c3c196a7c350858b9fc8cff))
|
||||
* eslint 格式化代码 ([0fea321](https://gitee.com/h_mo/uniapp-vue3-vite-ts-template/commit/0fea321256c3dd082d490c340d3e81d6e745ceca))
|
||||
* manifest.json ([c064617](https://gitee.com/h_mo/uniapp-vue3-vite-ts-template/commit/c064617c164aecf19064d2de42d0ccbe3c27f6f5))
|
||||
* remove console.log ([095dfbb](https://gitee.com/h_mo/uniapp-vue3-vite-ts-template/commit/095dfbbc6f126252b7482c3cedace51f14dc66fb))
|
||||
|
||||
|
||||
### 💄 Refactor | 重构
|
||||
|
||||
* **build:** 简化代理配置并更新HTTP错误处理重构代理配置,提取到proxy.ts中以简化vite.config.ts中的代码。同时,修改了faultTolerance.ts中的HTTP错误处理,使用具体的ResultEnum替代类型导入,以提高代码的准确性和可读性。 ([79240a2](https://gitee.com/h_mo/uniapp-vue3-vite-ts-template/commit/79240a29f847d37f76f3bb6fdf526396d5806fe4))
|
||||
* **components:** remove unused BasicInput, Iconify, and Test componentsRemove the unused BasicInput, Iconify, and Test components to clean up the codebase. ([743a021](https://gitee.com/h_mo/uniapp-vue3-vite-ts-template/commit/743a0219b31aa47810e23c8e66527930a46ec158))
|
||||
* **http:** 升级alova到v3, 优化状态码和逻辑错误处理 ([5a705f9](https://gitee.com/h_mo/uniapp-vue3-vite-ts-template/commit/5a705f9a44bcb105a8621b2e42e727ba2ca715d9))
|
||||
* **iconify:** 更新图标组件并调整样式 ([26a8bfb](https://gitee.com/h_mo/uniapp-vue3-vite-ts-template/commit/26a8bfba42171cec9cef36ddfa24f950de4a20eb))
|
||||
* Request使用依赖 [@luch-request](https://gitee.com/luch-request) ([b1ec215](https://gitee.com/h_mo/uniapp-vue3-vite-ts-template/commit/b1ec2157d789f5618528bf0257e276b3a8f7ec9a))
|
||||
* tailwindcss 替换 unocss ([09e4093](https://gitee.com/h_mo/uniapp-vue3-vite-ts-template/commit/09e4093acaeb8116427bfee595d5b418fc55b13a))
|
||||
|
||||
|
||||
### ⚡ Performance Improvements | 性能优化
|
||||
|
||||
* 获取Platform(平台)优化 ([8232791](https://gitee.com/h_mo/uniapp-vue3-vite-ts-template/commit/8232791a58cfd8bb8bb54a86d4c8ba152d40b37f))
|
||||
* 路由优化 ([4057671](https://gitee.com/h_mo/uniapp-vue3-vite-ts-template/commit/4057671444221edc7286e2b122b5c0f941a2f8d7))
|
||||
* 路由优化 ([cd50917](https://gitee.com/h_mo/uniapp-vue3-vite-ts-template/commit/cd50917754c29ccac5ed95edee629c732c534d5f))
|
||||
* 使用组合式 store ([a772075](https://gitee.com/h_mo/uniapp-vue3-vite-ts-template/commit/a772075200373aed024d3f5c97dbbd2eadd87ba6))
|
||||
* 优化部分代码 ([421ec1c](https://gitee.com/h_mo/uniapp-vue3-vite-ts-template/commit/421ec1cb3da54f64562743f6518c9cbb2e28936f))
|
||||
* 优化登录体验 ([d64ee1c](https://gitee.com/h_mo/uniapp-vue3-vite-ts-template/commit/d64ee1cb80d8e358c0a54904b6819ec86f832b69))
|
||||
* 注释logout api 的调用 ([7bc5b4c](https://gitee.com/h_mo/uniapp-vue3-vite-ts-template/commit/7bc5b4ccbaae3316522cf083fb3ea4cea4718064))
|
||||
* httpRequest 优化 ([d6b7132](https://gitee.com/h_mo/uniapp-vue3-vite-ts-template/commit/d6b71321b560570cb493799cc38ede98cbf958fe))
|
||||
|
||||
|
||||
### ✅ Tests | 测试
|
||||
|
||||
* 哈哈哈 ([5d279c7](https://gitee.com/h_mo/uniapp-vue3-vite-ts-template/commit/5d279c717329fc3c16c45d532babbb52dbf6ae3e))
|
||||
|
||||
|
||||
### 🔧 Continuous Integration | CI 配置
|
||||
|
||||
* 持续集成 ([8366605](https://gitee.com/h_mo/uniapp-vue3-vite-ts-template/commit/836660506861209037f7ce2507ed9c8290d0a80f))
|
||||
* 修改文件并lint ([d5848bd](https://gitee.com/h_mo/uniapp-vue3-vite-ts-template/commit/d5848bdb762ebecb31ea4b4cca1baad73bdba34d))
|
||||
* 一些配置和注释 ([6dade26](https://gitee.com/h_mo/uniapp-vue3-vite-ts-template/commit/6dade26acb160d0c3febc830c56d9a3e2e1fdc7e))
|
||||
* 一些配置和注释 ([497270c](https://gitee.com/h_mo/uniapp-vue3-vite-ts-template/commit/497270cf5e7174d7d893b93b25df9d281b0a6b09))
|
||||
* 一些配置和注释 ([4f1b0df](https://gitee.com/h_mo/uniapp-vue3-vite-ts-template/commit/4f1b0df492fb3c65d505f96a6aa34d7fe9d53296))
|
27
README.md
27
README.md
@ -14,10 +14,10 @@
|
||||
<img src="https://img.shields.io/badge/-ESLint9-4b32c3?logo=eslint&logoColor=white" />
|
||||
</a>
|
||||
<a href="https://pnpm.io/" target="_blank">
|
||||
<img src="https://img.shields.io/badge/-pnpm8-F69220?logo=pnpm&logoColor=white" />
|
||||
<img src="https://img.shields.io/badge/-pnpm-F69220?logo=pnpm&logoColor=white" />
|
||||
</a>
|
||||
<a href="https://unocss.dev/" target="_blank">
|
||||
<img src="https://img.shields.io/badge/-UnoCss-4d4d4d?logo=unocss" />
|
||||
<img src="https://img.shields.io/badge/-tailwindcss-0f172a?logo=tailwindcss" />
|
||||
</a>
|
||||
<a href="https://iconify.design/" target="_blank">
|
||||
<img src="https://img.shields.io/badge/-Iconify-1769aa?logo=Iconify" />
|
||||
@ -50,9 +50,9 @@
|
||||
|
||||
## 特性
|
||||
|
||||
- **最新技术栈**:使用 Vue3/Vite4/pinia ,TypeScript 等前端前沿技术开发;
|
||||
- **[Unocss](https://github.com/unocss/unocss)**: 原子化 CSS, [iconify](https://github.com/iconify/iconify)图标
|
||||
- **Eslint/Prettier**: 规范代码格式,统一编码;
|
||||
- **最新技术栈**:使用 Vue3/Vite5/pinia ,TypeScript 等前端前沿技术开发;
|
||||
- **[Tailwindcss](https://tailwindcss.com/)**: 原子化 CSS, [iconify](https://iconify.design/)图标
|
||||
- **Eslint**: 规范代码格式,统一编码;
|
||||
- **路由拦截**: [uni-mini-router](https://gitee.com/fant-mini/uni-mini-router),类似Vue Router的API和功能,在uni-app中进行路由跳转、传参、拦截等常用操作;
|
||||
- **请求拦截**: 使用[alova 请求](https://github.com/alovajs/alova),支持请求和响应拦截等;
|
||||
- **Mock 数据**: 配合 alova 请求的[@alova/mock](https://github.com/alovajs/mock),模拟 api 请求(App 不支持);
|
||||
@ -65,6 +65,10 @@
|
||||
├─ src
|
||||
│ ├─assets # 静态资源目录
|
||||
│ │
|
||||
│ ├─env # 环境配置文件
|
||||
│ │ ├─ .env
|
||||
│ │ └─...
|
||||
│ │
|
||||
│ ├─components # 组件目录
|
||||
│ │ ├─ BasicButton
|
||||
│ │ │ ├─index.vue
|
||||
@ -116,20 +120,15 @@
|
||||
│ ├─ interceptors # 拦截器相关目录
|
||||
│ └─ ...
|
||||
│
|
||||
├─ .env
|
||||
├─ .env.development
|
||||
├─ .env.production
|
||||
├─ .eslintignore
|
||||
├─ .eslintrc.js
|
||||
├─ .eslint.config.js
|
||||
├─ .gitignore
|
||||
├─ .prettierignore
|
||||
├─ .prettierrc.js
|
||||
├─ .npmrc
|
||||
├─ favicon.ico
|
||||
├─ index.html
|
||||
├─ package.json
|
||||
├─ pnpm-lock.yaml
|
||||
├─ README.md
|
||||
├─ tree.txt
|
||||
├─ tailwind.config.js
|
||||
├─ tsconfig.json
|
||||
└─ vite.config.ts
|
||||
|
||||
@ -149,6 +148,8 @@
|
||||
|
||||
- 安装依赖
|
||||
|
||||
> 若 pnpm 安装或运行失败,请使用 npm 或 yarn 安装依赖
|
||||
|
||||
```bash
|
||||
pnpm install
|
||||
```
|
||||
|
3
build/index.ts
Normal file
3
build/index.ts
Normal file
@ -0,0 +1,3 @@
|
||||
export * from './platform';
|
||||
export * from './proxy';
|
||||
export * from './vitePlugins';
|
15
build/platform.ts
Normal file
15
build/platform.ts
Normal file
@ -0,0 +1,15 @@
|
||||
import process from 'node:process';
|
||||
|
||||
const currentPlatform = process.env.UNI_PLATFORM;
|
||||
const isH5 = currentPlatform === 'h5';
|
||||
const isApp = currentPlatform === 'app';
|
||||
const WeappTailwindcssDisabled = isH5 || isApp;
|
||||
const isMp = !isH5 && !isApp;
|
||||
|
||||
export {
|
||||
isH5,
|
||||
isApp,
|
||||
WeappTailwindcssDisabled,
|
||||
isMp,
|
||||
currentPlatform,
|
||||
};
|
19
build/proxy.ts
Normal file
19
build/proxy.ts
Normal file
@ -0,0 +1,19 @@
|
||||
/**
|
||||
* Configure according to the proxy list
|
||||
* @param proxyList
|
||||
*/
|
||||
export function resolveProxy(proxyList: [string, string][] = []) {
|
||||
const proxy: Record<string, ProxyOptions> = {};
|
||||
for (const [prefix, target] of proxyList) {
|
||||
const isHttps = /^https:\/\//.test(target);
|
||||
proxy[prefix] = {
|
||||
target,
|
||||
changeOrigin: true,
|
||||
ws: true,
|
||||
rewrite: path => path.replace(new RegExp(`^${prefix}`), ''),
|
||||
// https is require secure=false
|
||||
...(isHttps ? { secure: false } : {}),
|
||||
};
|
||||
}
|
||||
return proxy;
|
||||
}
|
57
build/vitePlugins.ts
Normal file
57
build/vitePlugins.ts
Normal file
@ -0,0 +1,57 @@
|
||||
import type { PluginOption } from 'vite';
|
||||
import uni from '@dcloudio/vite-plugin-uni';
|
||||
import { UnifiedViteWeappTailwindcssPlugin as uvtw } from 'weapp-tailwindcss/vite';
|
||||
import autoImport from 'unplugin-auto-import/vite';
|
||||
import viteRestart from 'vite-plugin-restart';
|
||||
import { visualizer } from 'rollup-plugin-visualizer';
|
||||
import { WeappTailwindcssDisabled, isH5 } from './platform';
|
||||
|
||||
interface VitePluginConfig {
|
||||
isProd: boolean
|
||||
}
|
||||
|
||||
export function createVitePlugins({ isProd }: VitePluginConfig): PluginOption[] {
|
||||
return [
|
||||
// @ts-expect-error TODO uni() 会报错:uni is not a function,暂时使用此方式解决
|
||||
uni?.default(),
|
||||
uvtw({
|
||||
rem2rpx: true,
|
||||
disabled: WeappTailwindcssDisabled,
|
||||
// 使用新的 ast-grep 来处理 js 资源,速度是 babel 的2倍左右
|
||||
// 需要先安装 `@ast-grep/napi`
|
||||
// jsAstTool: 'ast-grep'
|
||||
}),
|
||||
autoImport({
|
||||
include: [
|
||||
/\.[tj]sx?$/, // .ts, .tsx, .js, .jsx
|
||||
/\.vue$/,
|
||||
/\.vue\?vue/, // .vue
|
||||
],
|
||||
imports: [
|
||||
'vue',
|
||||
'uni-app',
|
||||
'pinia',
|
||||
{
|
||||
'uni-mini-router': ['useRouter', 'useRoute'],
|
||||
},
|
||||
{
|
||||
'alova/client': ['useRequest'],
|
||||
},
|
||||
],
|
||||
dts: 'typings/auto-imports.d.ts',
|
||||
eslintrc: {
|
||||
enabled: true,
|
||||
},
|
||||
}),
|
||||
viteRestart({
|
||||
restart: ['vite.config.ts', 'src/pages.json'],
|
||||
}),
|
||||
isH5 && isProd
|
||||
&& visualizer({
|
||||
filename: './node_modules/.cache/visualizer/stats.html',
|
||||
open: true,
|
||||
gzipSize: true,
|
||||
brotliSize: true,
|
||||
}),
|
||||
];
|
||||
}
|
@ -12,7 +12,6 @@ export default antfu(
|
||||
formatters: true,
|
||||
vue: true,
|
||||
jsx: true,
|
||||
unocss: true,
|
||||
env: {
|
||||
node: true,
|
||||
},
|
||||
|
99
package.json
99
package.json
@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "uniapp_vue3_vite_ts",
|
||||
"type": "module",
|
||||
"version": "2.0.0-alpha.1",
|
||||
"version": "2.0.0",
|
||||
"scripts": {
|
||||
"dev:app": "uni -p app",
|
||||
"dev:custom": "uni -p",
|
||||
@ -13,7 +13,7 @@
|
||||
"dev:mp-lark": "uni -p mp-lark",
|
||||
"dev:mp-qq": "uni -p mp-qq",
|
||||
"dev:mp-toutiao": "uni -p mp-toutiao",
|
||||
"dev:mp-weixin": "pnpm git:hooks && uni -p mp-weixin --devtools",
|
||||
"dev:mp-weixin": "pnpm git:hooks && uni -p mp-weixin",
|
||||
"dev:quickapp-webview": "uni -p quickapp-webview",
|
||||
"dev:quickapp-webview-huawei": "uni -p quickapp-webview-huawei",
|
||||
"dev:quickapp-webview-union": "uni -p quickapp-webview-union",
|
||||
@ -32,64 +32,73 @@
|
||||
"build:quickapp-webview-huawei": "uni build -p quickapp-webview-huawei",
|
||||
"build:quickapp-webview-union": "uni build -p quickapp-webview-union",
|
||||
"lint:fix": "eslint . --fix",
|
||||
"git:hooks": "npx simple-git-hooks"
|
||||
"git:hooks": "npx simple-git-hooks",
|
||||
"postinstall": "weapp-tw patch",
|
||||
"version:first": "commit-and-tag-version --first-release",
|
||||
"version:alpha": "commit-and-tag-version --prerelease alpha",
|
||||
"version:beta": "commit-and-tag-version --prerelease beta",
|
||||
"version:rc": "commit-and-tag-version --prerelease rc",
|
||||
"version:patch": "commit-and-tag-version --release-as patch",
|
||||
"version:minor": "commit-and-tag-version --release-as minor",
|
||||
"version:major": "commit-and-tag-version --release-as major"
|
||||
},
|
||||
"dependencies": {
|
||||
"@alova/adapter-uniapp": "^1.2.2",
|
||||
"@alova/mock": "^1.5.2",
|
||||
"@dcloudio/uni-app": "3.0.0-alpha-4020220240624001",
|
||||
"@dcloudio/uni-app-plus": "3.0.0-alpha-4020220240624001",
|
||||
"@dcloudio/uni-components": "3.0.0-alpha-4020220240624001",
|
||||
"@dcloudio/uni-h5": "3.0.0-alpha-4020220240624001",
|
||||
"@dcloudio/uni-i18n": "3.0.0-alpha-4020220240624001",
|
||||
"@dcloudio/uni-mp-alipay": "3.0.0-alpha-4020220240624001",
|
||||
"@dcloudio/uni-mp-baidu": "3.0.0-alpha-4020220240624001",
|
||||
"@dcloudio/uni-mp-kuaishou": "3.0.0-alpha-4020220240624001",
|
||||
"@dcloudio/uni-mp-lark": "3.0.0-alpha-4020220240624001",
|
||||
"@dcloudio/uni-mp-qq": "3.0.0-alpha-4020220240624001",
|
||||
"@dcloudio/uni-mp-toutiao": "3.0.0-alpha-4020220240624001",
|
||||
"@dcloudio/uni-mp-weixin": "3.0.0-alpha-4020220240624001",
|
||||
"@dcloudio/uni-quickapp-webview": "3.0.0-alpha-4020220240624001",
|
||||
"@alova/adapter-uniapp": "^2.0.4",
|
||||
"@alova/mock": "^2.0.4",
|
||||
"@dcloudio/uni-app": "3.0.0-alpha-4020520240808001",
|
||||
"@dcloudio/uni-app-plus": "3.0.0-alpha-4020520240808001",
|
||||
"@dcloudio/uni-components": "3.0.0-alpha-4020520240808001",
|
||||
"@dcloudio/uni-h5": "3.0.0-alpha-4020520240808001",
|
||||
"@dcloudio/uni-i18n": "3.0.0-alpha-4020520240808001",
|
||||
"@dcloudio/uni-mp-alipay": "3.0.0-alpha-4020520240808001",
|
||||
"@dcloudio/uni-mp-baidu": "3.0.0-alpha-4020520240808001",
|
||||
"@dcloudio/uni-mp-kuaishou": "3.0.0-alpha-4020520240808001",
|
||||
"@dcloudio/uni-mp-lark": "3.0.0-alpha-4020520240808001",
|
||||
"@dcloudio/uni-mp-qq": "3.0.0-alpha-4020520240808001",
|
||||
"@dcloudio/uni-mp-toutiao": "3.0.0-alpha-4020520240808001",
|
||||
"@dcloudio/uni-mp-weixin": "3.0.0-alpha-4020520240808001",
|
||||
"@dcloudio/uni-quickapp-webview": "3.0.0-alpha-4020520240808001",
|
||||
"@multiavatar/multiavatar": "^1.0.7",
|
||||
"alova": "^2.21.3",
|
||||
"alova": "^3.0.9",
|
||||
"crypto-js": "^4.2.0",
|
||||
"lodash-es": "^4.17.21",
|
||||
"pinia": "^2.1.7",
|
||||
"vue": "^3.4.30"
|
||||
"pinia": "^2.2.2",
|
||||
"vue": "^3.4.38"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@antfu/eslint-config": "^2.21.1",
|
||||
"@dcloudio/types": "^3.4.8",
|
||||
"@dcloudio/uni-automator": "3.0.0-alpha-4020220240624001",
|
||||
"@dcloudio/uni-cli-shared": "3.0.0-alpha-4020220240624001",
|
||||
"@dcloudio/uni-stacktracey": "3.0.0-alpha-4020220240624001",
|
||||
"@dcloudio/uni-vue-devtools": "3.0.0-alpha-4020220240624001",
|
||||
"@dcloudio/vite-plugin-uni": "3.0.0-alpha-4020220240624001",
|
||||
"@iconify/json": "^2.2.206",
|
||||
"@antfu/eslint-config": "^2.26.0",
|
||||
"@dcloudio/types": "^3.4.12",
|
||||
"@dcloudio/uni-automator": "3.0.0-alpha-4020520240808001",
|
||||
"@dcloudio/uni-cli-shared": "3.0.0-alpha-4020520240808001",
|
||||
"@dcloudio/uni-stacktracey": "3.0.0-alpha-4020520240808001",
|
||||
"@dcloudio/vite-plugin-uni": "3.0.0-alpha-4020520240808001",
|
||||
"@egoist/tailwindcss-icons": "^1.8.1",
|
||||
"@iconify/json": "^2.2.238",
|
||||
"@types/crypto-js": "^4.2.2",
|
||||
"@types/lodash-es": "^4.17.12",
|
||||
"@types/node": "^20.14.8",
|
||||
"@unocss/eslint-plugin": "^0.61.0",
|
||||
"@vitejs/plugin-vue": "^5.0.5",
|
||||
"@vue/runtime-core": "^3.4.30",
|
||||
"eslint": "^9.5.0",
|
||||
"@types/node": "^20.16.1",
|
||||
"@vitejs/plugin-vue": "^5.1.2",
|
||||
"@vue/runtime-core": "^3.4.38",
|
||||
"autoprefixer": "^10.4.20",
|
||||
"commit-and-tag-version": "^12.4.1",
|
||||
"eslint": "^9.9.0",
|
||||
"eslint-plugin-format": "^0.1.2",
|
||||
"globals": "^15.6.0",
|
||||
"lint-staged": "^15.2.7",
|
||||
"globals": "^15.9.0",
|
||||
"lint-staged": "^15.2.9",
|
||||
"picocolors": "^1.0.1",
|
||||
"postcss": "^8.4.41",
|
||||
"rollup-plugin-visualizer": "^5.12.0",
|
||||
"sass": "^1.77.6",
|
||||
"sass": "^1.77.8",
|
||||
"simple-git-hooks": "^2.11.1",
|
||||
"tsx": "^4.15.7",
|
||||
"typescript": "^5.5.2",
|
||||
"tailwindcss": "^3.4.10",
|
||||
"tsx": "^4.17.0",
|
||||
"typescript": "^5.5.4",
|
||||
"uni-mini-router": "^0.1.6",
|
||||
"uni-read-pages-vite": "^0.0.6",
|
||||
"unocss": "^0.61.0",
|
||||
"unocss-preset-weapp": "^0.60.1",
|
||||
"unplugin-auto-import": "^0.17.6",
|
||||
"unplugin-transform-class": "^0.5.3",
|
||||
"vite": "^5.3.1",
|
||||
"vite-plugin-restart": "^0.4.0"
|
||||
"unplugin-auto-import": "^0.18.2",
|
||||
"vite": "^5.4.1",
|
||||
"vite-plugin-restart": "^0.4.1",
|
||||
"weapp-tailwindcss": "^3.5.0"
|
||||
},
|
||||
"simple-git-hooks": {
|
||||
"pre-commit": "npx lint-staged",
|
||||
|
12
postcss.config.ts
Normal file
12
postcss.config.ts
Normal file
@ -0,0 +1,12 @@
|
||||
import tailwindcss from 'tailwindcss';
|
||||
import autoprefixer from 'autoprefixer';
|
||||
import type { AcceptedPlugin } from 'postcss';
|
||||
import cssMacro from 'weapp-tailwindcss/css-macro/postcss';
|
||||
|
||||
const plugins: AcceptedPlugin[] = [tailwindcss(), autoprefixer()];
|
||||
|
||||
// 可以使用 postcss-pxtransform 来进行 px 转 rpx 的功能
|
||||
|
||||
plugins.push(cssMacro);
|
||||
|
||||
export default plugins;
|
@ -16,4 +16,7 @@ onHide(() => {
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
@import 'tailwindcss/base';
|
||||
@import 'tailwindcss/utilities';
|
||||
@import 'tailwindcss/components';
|
||||
</style>
|
||||
|
@ -1,39 +1,34 @@
|
||||
<script lang="ts" setup name="Iconify">
|
||||
<script lang="ts" setup>
|
||||
/**
|
||||
* @name Iconify
|
||||
* @desc 图标组件 使用 iconify + tailwindcss
|
||||
* 更多图标库 https://icon-sets.iconify.design/
|
||||
* @docs https://github.com/egoist/tailwindcss-icons
|
||||
* @example <Iconify icon="i-mdi-account-box" size="32" color="green" />
|
||||
*/
|
||||
|
||||
interface Props {
|
||||
icon: string
|
||||
size?: string | number
|
||||
color?: string
|
||||
}
|
||||
/**
|
||||
* @name Iconify
|
||||
* @desc 图标
|
||||
* @docs https://iconify.design/docs/icon-components/vue/
|
||||
* @example <Iconify icon="ant-design:home-outlined" />
|
||||
*/
|
||||
const props = withDefaults(defineProps<Props>(), {
|
||||
size: 'inherit',
|
||||
color: 'inherit',
|
||||
});
|
||||
|
||||
const emits = defineEmits(['click']);
|
||||
function click() {
|
||||
emits('click');
|
||||
}
|
||||
|
||||
function isNumber(str: string | number): boolean {
|
||||
return !Number.isNaN(Number(str));
|
||||
}
|
||||
const iconSize = computed(() => (Number.isNaN(Number(props.size)) ? `${props.size}` : `${props.size}rpx`));
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<view class="iconify-icon" :class="[props.icon]" @click="click" />
|
||||
<text class="iconify-icon" :class="[props.icon]" />
|
||||
</template>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.iconify-icon {
|
||||
display: inline-block;
|
||||
line-height: 1;
|
||||
font-size: v-bind('isNumber(props.size) ? `${props.size}px` : props.size');
|
||||
color: v-bind('props.color');
|
||||
font-size: v-bind('iconSize');
|
||||
color: v-bind('color');
|
||||
}
|
||||
</style>
|
||||
|
@ -1,6 +1,5 @@
|
||||
import { createSSRApp } from 'vue';
|
||||
import App from './App.vue';
|
||||
import 'virtual:uno.css';
|
||||
import { setupRouter } from './router';
|
||||
import { setupStore } from './stores';
|
||||
|
||||
|
@ -19,7 +19,7 @@ function handleLoginOut() {
|
||||
<template>
|
||||
<view class="text-md pt-36">
|
||||
<view v-if="loggedIn" class="text-center">
|
||||
<image class="h-56 w-56" :src="userInfo?.avatar" />
|
||||
<image class="h-8 w-8" :src="userInfo?.avatar" />
|
||||
<view class="mt-2">
|
||||
{{ userInfo?.nickname }}
|
||||
</view>
|
||||
|
@ -5,15 +5,17 @@ const demo = ref('Demo');
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<view class="pt-36 text-lg font-medium flex flex-col justify-center items-center">
|
||||
<view class="flex flex-col items-center justify-center pt-36 text-lg font-medium">
|
||||
{{ demo }}
|
||||
<view class="mt-30px">
|
||||
iconify 组件
|
||||
</view>
|
||||
<view class="mt-30px center flex flex-row gap-10px">
|
||||
<Iconify icon="i-ri-alipay-fill" size="32" color="blue" />
|
||||
<Iconify icon="i-ri-settings-5-line" size="48" color="orange" />
|
||||
<Iconify icon="i-ri-wechat-fill" size="32" color="green" />
|
||||
<Iconify icon="i-mdi-account-box" size="64" color="blue" />
|
||||
<Iconify icon="i-mdi-account-box" size="48" color="orange" />
|
||||
<Iconify icon="i-mdi-account-box" size="32" color="green" />
|
||||
<Iconify icon="i-mdi-account-box" />
|
||||
<Iconify icon="i-svg-spinners-12-dots-scale-rotate" />
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
@ -7,8 +7,8 @@ const appTitle = 'uniapp-vue3';
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<view class="pt-36 flex flex-col gap-y-2 items-center">
|
||||
<image :src="logo" class="h-56 w-56" alt="" mode="widthFix" />
|
||||
<view class="flex flex-col items-center gap-y-2 pt-36">
|
||||
<image :src="logo" class="h-8 w-8" alt="" mode="widthFix" />
|
||||
<view class="text-xl font-semibold">
|
||||
{{ appTitle }}
|
||||
</view>
|
||||
|
@ -12,7 +12,7 @@ const userStore = useUserStore();
|
||||
<view class="mt-36 text-center">
|
||||
登录后访问log
|
||||
</view>
|
||||
<image class="my-4 h-48 w-48" :src="userStore.userInfo?.avatar" mode="aspectFit" lazy-load="false" binderror="" bindload="" />
|
||||
<image class="my-4 h-8 w-8" :src="userStore.userInfo?.avatar" mode="aspectFit" lazy-load="false" binderror="" bindload="" />
|
||||
<view>{{ userStore.userInfo?.nickname }}</view>
|
||||
</view>
|
||||
</template>
|
||||
|
@ -25,6 +25,7 @@ function submit(e: any) {
|
||||
const params = omit(unref(pageQuery), ['redirect', 'tabBar']);
|
||||
if (unref(pageQuery)) {
|
||||
// 这里replace方法无法跳转tabbar页面故改为replaceAll
|
||||
// eslint-disable-next-line ts/no-unused-expressions
|
||||
unref(pageQuery)?.tabBar === 'true'
|
||||
? router.replaceAll({ name: unref(pageQuery)?.redirect, params })
|
||||
: router.replace({ name: unref(pageQuery)?.redirect, params });
|
||||
|
@ -19,7 +19,7 @@ function backHome() {
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<view class="pt-320rpx flex flex-col w-screen items-center">
|
||||
<view class="w-screen flex flex-col items-center pt-320rpx">
|
||||
<image class="w-360rpx" mode="widthFix" src="/static/svg/weep.svg" />
|
||||
<view class="mb-40rpx">
|
||||
<text>{{ go }} 页面找不到了~</text>
|
||||
|
@ -8,7 +8,6 @@ export function createRouterGuard(router: Router) {
|
||||
|
||||
function createBeforeEachGuard(router: Router) {
|
||||
router.beforeEach((to, _, next) => {
|
||||
console.log('beforeEach', to);
|
||||
const _isLogin = isLogin();
|
||||
if (to && to?.meta?.ignoreAuth) {
|
||||
// 如果目标路由忽略验证直接跳转
|
||||
@ -39,6 +38,5 @@ function createAfterEachGuard(router: Router) {
|
||||
// 如果已经登录且目标页面是登录页面则跳转至首页
|
||||
router.replaceAll({ name: 'Home' });
|
||||
}
|
||||
console.log('afterEach', to);
|
||||
});
|
||||
}
|
||||
|
@ -1,5 +1,4 @@
|
||||
import { defineStore } from 'pinia';
|
||||
import { useRequest } from 'alova';
|
||||
import { getUserInfoApi } from '@/services/api/user';
|
||||
import type { UserInfoModel } from '@/services/model/userModel';
|
||||
import { login as loginApi } from '@/services/api/auth';
|
||||
|
4
src/types/unplugin-transform-class-vite.d.ts
vendored
4
src/types/unplugin-transform-class-vite.d.ts
vendored
@ -1,4 +0,0 @@
|
||||
declare module 'unplugin-transform-class/vite' {
|
||||
const transformClassVitePlugin: any;
|
||||
export default transformClassVitePlugin;
|
||||
}
|
1
src/utils/cache/storageCache.ts
vendored
1
src/utils/cache/storageCache.ts
vendored
@ -85,6 +85,7 @@ export function createStorage({
|
||||
return def;
|
||||
}
|
||||
return value;
|
||||
// eslint-disable-next-line unused-imports/no-unused-vars
|
||||
} catch (e) {
|
||||
return def;
|
||||
}
|
||||
|
@ -1,6 +1,12 @@
|
||||
import { Toast } from '@/utils/uniapi/prompt';
|
||||
import { ResultEnum } from '@/enums/httpEnum';
|
||||
|
||||
export function checkStatus(status: number, msg: string): void {
|
||||
/**
|
||||
* Http错误处理
|
||||
* @param status
|
||||
* @param msg
|
||||
*/
|
||||
export function handleHttpStatus(status: number, msg: string): void {
|
||||
let errMessage = null;
|
||||
switch (status) {
|
||||
case 400:
|
||||
@ -49,3 +55,22 @@ export function checkStatus(status: number, msg: string): void {
|
||||
Toast(errMessage);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 逻辑错误处理
|
||||
*/
|
||||
export function handleLogicError(errCode: ResultEnum, errMsg?: string) {
|
||||
switch (errCode) {
|
||||
case ResultEnum.ERROR:
|
||||
// TODO ERROR处理
|
||||
// ...
|
||||
break;
|
||||
case ResultEnum.FAIL:
|
||||
// TODO FAIL处理
|
||||
// ...
|
||||
break;
|
||||
}
|
||||
if (errMsg) {
|
||||
Toast(errMsg);
|
||||
}
|
||||
}
|
@ -1,7 +1,7 @@
|
||||
import { createAlova } from 'alova';
|
||||
import AdapterUniapp from '@alova/adapter-uniapp';
|
||||
import { assign } from 'lodash-es';
|
||||
import { checkStatus } from './checkStatus';
|
||||
import { handleHttpStatus, handleLogicError } from './faultTolerance';
|
||||
import { getBaseUrl, isUseMock } from '@/utils/env';
|
||||
import { mockAdapter } from '@/mock';
|
||||
import { ContentTypeEnum, ResultEnum } from '@/enums/httpEnum';
|
||||
@ -28,7 +28,7 @@ const alovaInstance = createAlova({
|
||||
/* #endif */
|
||||
}),
|
||||
timeout: 5000,
|
||||
beforeRequest: (method) => {
|
||||
beforeRequest: async (method) => {
|
||||
method.config.headers = assign(method.config.headers, ContentType);
|
||||
const { config } = method;
|
||||
const ignoreAuth = !config.meta?.ignoreAuth;
|
||||
@ -57,17 +57,26 @@ const alovaInstance = createAlova({
|
||||
if (code === ResultEnum.SUCCESS) {
|
||||
return data as any;
|
||||
}
|
||||
checkStatus(statusCode, message || '');
|
||||
// 逻辑错误处理,与业务相关
|
||||
handleLogicError(code, message);
|
||||
throw new Error(`请求错误[${code}]:${message}`);
|
||||
}
|
||||
throw new Error(`请求错误[${statusCode}]:${errMsg}`);
|
||||
// 处理http状态错误
|
||||
handleHttpStatus(statusCode, message || '');
|
||||
throw new Error(`HTTP请求错误[${statusCode}]:${errMsg}`);
|
||||
},
|
||||
|
||||
/**
|
||||
* 请求失败的拦截器,请求错误时将会进入该拦截器。
|
||||
*/
|
||||
onError: (err) => {
|
||||
throw new Error(`请求错误:${err}`);
|
||||
onError: async (err) => {
|
||||
throw new Error(`请求失败:${err}`);
|
||||
},
|
||||
/**
|
||||
* 请求完成的拦截器, 无论请求成功或失败都会进入该拦截器
|
||||
*/
|
||||
onComplete: async () => {
|
||||
// 处理请求完成逻辑
|
||||
},
|
||||
},
|
||||
});
|
||||
|
@ -60,6 +60,7 @@ export function isString(val: unknown): val is string {
|
||||
return is(val, 'String');
|
||||
}
|
||||
|
||||
// eslint-disable-next-line ts/no-unsafe-function-type
|
||||
export function isFunction(val: unknown): val is Function {
|
||||
return typeof val === 'function';
|
||||
}
|
||||
|
18
tailwind.config.js
Normal file
18
tailwind.config.js
Normal file
@ -0,0 +1,18 @@
|
||||
import { getIconCollections, iconsPlugin } from '@egoist/tailwindcss-icons';
|
||||
import { isMp } from './build/platform';
|
||||
|
||||
/** @type {import('tailwindcss').Config} */
|
||||
export default {
|
||||
content: ['./public/index.html', './src/**/*.{html,js,ts,jsx,tsx,vue}'],
|
||||
theme: {
|
||||
extend: {},
|
||||
},
|
||||
corePlugins: {
|
||||
// 小程序去使用 h5 的 preflight 和响应式 container 没有意义
|
||||
preflight: !isMp,
|
||||
container: !isMp,
|
||||
},
|
||||
plugins: [iconsPlugin({
|
||||
collections: getIconCollections(['mdi', 'svg-spinners']),
|
||||
})],
|
||||
};
|
@ -7,7 +7,7 @@
|
||||
/* 实验选项 */
|
||||
"experimentalDecorators": true,
|
||||
"baseUrl": "./", // 指定基目录以解析非相对模块名
|
||||
"rootDir": "./src", // 编译出目标语言版本
|
||||
"rootDir": ".", // 编译出目标语言版本
|
||||
"module": "ESNext", // 生成代码的模板标准
|
||||
"moduleResolution": "node", // 删除注释
|
||||
"paths": { "@/*": ["./src/*"] }, // 有错误时不进行编译
|
||||
|
@ -1,73 +0,0 @@
|
||||
/**
|
||||
* unocss defineConfig
|
||||
* @link unocss: https://github.com/unocss/unocss
|
||||
* @type {import('unocss').UserConfig}
|
||||
*/
|
||||
|
||||
import { defineConfig, presetIcons } from 'unocss';
|
||||
import presetWeapp from 'unocss-preset-weapp';
|
||||
import { transformerAttributify, transformerClass } from 'unocss-preset-weapp/transformer';
|
||||
|
||||
const transformRules = {
|
||||
'.': '-d2e-',
|
||||
'/': '-s2f-',
|
||||
':': '-c3a-',
|
||||
'%': '-p25-',
|
||||
'!': '-e21-',
|
||||
'#': '-w23-',
|
||||
'(': '-b28-',
|
||||
')': '-b29-',
|
||||
'[': '-f4b-',
|
||||
']': '-f5d-',
|
||||
'$': '-r24-',
|
||||
',': '-r2c-',
|
||||
};
|
||||
|
||||
const prefix = '';
|
||||
|
||||
export default defineConfig({
|
||||
presets: [
|
||||
// https://github.com/MellowCo/unocss-preset-weapp
|
||||
presetWeapp({
|
||||
nonValuedAttribute: true,
|
||||
prefix,
|
||||
whRpx: true,
|
||||
transform: true,
|
||||
platform: 'uniapp',
|
||||
transformRules,
|
||||
}),
|
||||
presetIcons({
|
||||
scale: 1.2,
|
||||
warn: true,
|
||||
}),
|
||||
],
|
||||
shortcuts: [
|
||||
{
|
||||
center: 'flex justify-center items-center',
|
||||
},
|
||||
],
|
||||
theme: {
|
||||
colors: {
|
||||
primary: '#007AFF',
|
||||
secondary: '#4CD964',
|
||||
danger: '#FF3B30',
|
||||
warning: '#FF9500',
|
||||
info: '#5AC8FA',
|
||||
light: '#F0F0F0',
|
||||
dark: '#1A1A1A',
|
||||
},
|
||||
fontSize: {
|
||||
mini: ['20rpx', '26rpx'],
|
||||
},
|
||||
},
|
||||
transformers: [
|
||||
transformerAttributify({
|
||||
classPrefix: prefix,
|
||||
transformRules,
|
||||
nonValuedAttribute: true,
|
||||
}),
|
||||
transformerClass({
|
||||
transformRules,
|
||||
}),
|
||||
],
|
||||
});
|
@ -8,21 +8,14 @@ import process from 'node:process';
|
||||
import type { UserConfig } from 'vite';
|
||||
import { defineConfig, loadEnv } from 'vite';
|
||||
import TransformPages from 'uni-read-pages-vite';
|
||||
import uni from '@dcloudio/vite-plugin-uni';
|
||||
import UnoCSS from 'unocss/vite';
|
||||
import transformClass from 'unplugin-transform-class/vite';
|
||||
import { visualizer } from 'rollup-plugin-visualizer';
|
||||
import ViteRestart from 'vite-plugin-restart';
|
||||
import AutoImport from 'unplugin-auto-import/vite';
|
||||
import postcssPlugins from './postcss.config';
|
||||
import { createVitePlugins, currentPlatform, resolveProxy } from './build';
|
||||
|
||||
export default defineConfig(async ({ mode }) => {
|
||||
const root = process.cwd();
|
||||
const env = loadEnv(mode, resolve(root, 'env'));
|
||||
const isProd = mode === 'production';
|
||||
const { UNI_PLATFORM } = process.env;
|
||||
const isH5 = UNI_PLATFORM === 'h5';
|
||||
const { VITE_PROXY_PREFIX, VITE_UPLOAD_PROXY_PREFIX, VITE_BASE_URL, VITE_UPLOAD_URL, VITE_PORT } = env;
|
||||
|
||||
return {
|
||||
base: './',
|
||||
envDir: './env', // 自定义env目录
|
||||
@ -36,7 +29,7 @@ export default defineConfig(async ({ mode }) => {
|
||||
// 自定义全局变量
|
||||
define: {
|
||||
'process.env': {},
|
||||
'PLATFORM': JSON.stringify(UNI_PLATFORM),
|
||||
'PLATFORM': JSON.stringify(currentPlatform),
|
||||
'ROUTES': new TransformPages().routes,
|
||||
},
|
||||
css: {
|
||||
@ -45,62 +38,17 @@ export default defineConfig(async ({ mode }) => {
|
||||
additionalData: '@import "./src/uni.scss";',
|
||||
},
|
||||
},
|
||||
postcss: {
|
||||
plugins: postcssPlugins,
|
||||
},
|
||||
},
|
||||
plugins: [
|
||||
// @ts-expect-error TODO uni() 会报错:uni is not a function,暂时使用此方式解决
|
||||
uni?.default(),
|
||||
AutoImport({
|
||||
include: [
|
||||
/\.[tj]sx?$/, // .ts, .tsx, .js, .jsx
|
||||
/\.vue$/,
|
||||
/\.vue\?vue/, // .vue
|
||||
],
|
||||
imports: [
|
||||
'vue',
|
||||
'uni-app',
|
||||
'pinia',
|
||||
{
|
||||
'uni-mini-router': ['useRouter', 'useRoute'],
|
||||
},
|
||||
{
|
||||
alova: ['useRequest'],
|
||||
},
|
||||
],
|
||||
dts: 'typings/auto-imports.d.ts',
|
||||
eslintrc: {
|
||||
enabled: true,
|
||||
},
|
||||
}),
|
||||
UnoCSS(),
|
||||
transformClass(),
|
||||
ViteRestart({
|
||||
restart: ['vite.config.ts', 'src/pages.json'],
|
||||
}),
|
||||
isH5 && isProd
|
||||
&& visualizer({
|
||||
filename: './node_modules/.cache/visualizer/stats.html',
|
||||
open: true,
|
||||
gzipSize: true,
|
||||
brotliSize: true,
|
||||
}),
|
||||
],
|
||||
plugins: createVitePlugins({ isProd }),
|
||||
// 开发服务器配置
|
||||
server: {
|
||||
host: true,
|
||||
// open: true,
|
||||
port: Number.parseInt(VITE_PORT!, 10),
|
||||
proxy: {
|
||||
[VITE_PROXY_PREFIX!]: {
|
||||
target: VITE_BASE_URL,
|
||||
changeOrigin: true,
|
||||
rewrite: (path: string) => path.replace(new RegExp(`^${VITE_PROXY_PREFIX}`), ''),
|
||||
},
|
||||
[VITE_UPLOAD_PROXY_PREFIX!]: {
|
||||
target: VITE_UPLOAD_URL,
|
||||
changeOrigin: true,
|
||||
rewrite: (path: string) => path.replace(new RegExp(`^${VITE_UPLOAD_PROXY_PREFIX}`), ''),
|
||||
},
|
||||
},
|
||||
proxy: resolveProxy([[VITE_PROXY_PREFIX, VITE_BASE_URL], [VITE_UPLOAD_PROXY_PREFIX, VITE_UPLOAD_URL]]),
|
||||
},
|
||||
// 构建配置
|
||||
build: {
|
||||
|
Loading…
x
Reference in New Issue
Block a user