更新记录
0.1.0(2025-08-01)
下载此版本
- 类
vue-router
API:与 vue-router
相似的 API 设计,学习成本低,迁移简单
- 多种导航方式:
push
:保留当前页面的跳转
replace
:替换当前页面
launch
:重启应用并跳转
tab
:切换 tabBar 页面
go
/back
:页面返回控制
- 路由守卫:
beforeEach
:导航前执行(适合权限验证)
afterEach
:导航后执行(适合埋点统计)
- 实用方法:
getCurrentRoute
: 获取当前路由信息
setCustomGetCurrentRoute
: 设置自定义获取当前路由的函数
- 实用工具:
parseLocation
:解析路由位置
buildUrl
:构建完整 URL
getCurrentRoute
:获取当前路由
- Hooks:
- 组件:
- 全平台适配:完美支持 H5、小程序和 App
平台兼容性
uni-app(4.23)
Vue2 |
Vue3 |
Chrome |
Safari |
app-vue |
app-nvue |
Android |
iOS |
鸿蒙 |
√ |
√ |
√ |
√ |
√ |
√ |
√ |
√ |
√ |
微信小程序 |
支付宝小程序 |
抖音小程序 |
百度小程序 |
快手小程序 |
京东小程序 |
鸿蒙元服务 |
QQ小程序 |
飞书小程序 |
快应用-华为 |
快应用-联盟 |
√ |
√ |
√ |
√ |
√ |
√ |
√ |
√ |
√ |
√ |
√ |
uni-app x(4.23)
Chrome |
Safari |
Android |
iOS |
鸿蒙 |
微信小程序 |
√ |
√ |
√ |
√ |
√ |
√ |
其他
mx-router 
- 这是一个专为 uni-app 开发的路由管理库,采用类似
vue-router
的设计风格,并提供丰富的工具函数,帮助开发者轻松实现跨平台路由管理。
- 该库基于 uni-app 提供的路由 API 进行封装,同时引入了类似
vue-router
的路由配置方式,使开发者能够快速上手。
- 提供了丰富的路由守卫、导航方法和工具函数,帮助开发者实现更复杂的路由管理需求。
- 该库的设计考虑了跨平台兼容性,能够在 H5、小程序和 App 等多个平台上使用。
- 该库支持 uni-app 的 Vue2 和 Vue3 语法,部分函数存在不兼容问题,请仔细阅读文档。
- 提供了详细的文档和示例,帮助开发者快速上手。
Get started with the [documentation]().
Quickstart
- Install it by importing HBuilderX from the plugin market
- Add it to an existing Uni-App Project:
# 安装 @meng-xi/uni-router
pnpm install @meng-xi/uni-router
Contributing
Welcome to contribute code to @meng-xi/uni-router
. The steps are as follows:
- Fork the repository: Fork this project on GitHub.
- Clone the code: Clone the forked project to your local machine.
git clone https://github.com/your-username/uni-router.git
cd uni-router
- Create a new branch: Create a new feature branch based on the master branch.
git checkout -b feature/your-feature
- Commit your changes: Make sure your code passes the tests and commit your changes with a clear commit message.
git add .
git commit -m "feat: add your feature description"
- Push your branch: Push your local branch to GitHub.
git push origin feature/your-feature
- Create a PR: Create a Pull Request on GitHub and wait for review.