F-loat / Mpvue Router Patch
Licence: mit
🛴在 mpvue 中使用 vue-router 兼容的路由写法
Stars: ✭ 298
Programming Languages
javascript
184084 projects - #8 most used programming language
Projects that are alternatives of or similar to Mpvue Router Patch
Activityrouter
Router activities and methods with url for android
Stars: ✭ 2,811 (+843.29%)
Mutual labels: router
Simple Php Router
Simple, fast and yet powerful PHP router that is easy to get integrated and in any project. Heavily inspired by the way Laravel handles routing, with both simplicity and expand-ability in mind.
Stars: ✭ 279 (-6.38%)
Mutual labels: router
Angular
UI-Router for Angular: State-based routing for Angular (v2+)
Stars: ✭ 287 (-3.69%)
Mutual labels: router
React Native Simple Router
A community maintained router component for React Native
Stars: ✭ 266 (-10.74%)
Mutual labels: router
Swup
🎉 Complete, flexible, extensible and easy to use page transition library for your static web.
Stars: ✭ 3,190 (+970.47%)
Mutual labels: router
Pjax Api
The second generation PJAX for advanced web frameworks.
Stars: ✭ 291 (-2.35%)
Mutual labels: router
Vue Smart Route
Smart route search to make intelligent looking apps with Vue.js.
Stars: ✭ 280 (-6.04%)
Mutual labels: router
React Overdrive
Super easy magic-move transitions for React apps
Stars: ✭ 3,001 (+907.05%)
Mutual labels: router
Vue Mpvue Chatrobot
㊙A chat robot for web & Wechat producted by vue+mpvue+nodejs.
Stars: ✭ 269 (-9.73%)
Mutual labels: mpvue
Takeoff
A rapid development environment using docker for convenience.
Stars: ✭ 271 (-9.06%)
Mutual labels: router
Link
A PHP router that helps you create webapps and APIs effortlessly
Stars: ✭ 282 (-5.37%)
Mutual labels: router
Ffrouter
Powerful and easy-to-use URL routing library in iOS that supports URL Rewrite(强大、易用、支持 URL Rewrite的 iOS 路由库)
Stars: ✭ 263 (-11.74%)
Mutual labels: router
Frontexpress
An Express.js-Style router for the front-end
Stars: ✭ 263 (-11.74%)
Mutual labels: router
Fluro
Fluro is a Flutter routing library that adds flexible routing options like wildcards, named parameters and clear route definitions.
Stars: ✭ 3,372 (+1031.54%)
Mutual labels: router
Abstract State Router
Like ui-router, but without all the Angular. The best way to structure a single-page webapp.
Stars: ✭ 288 (-3.36%)
Mutual labels: router
Wouter
🥢 A minimalist-friendly ~1.5KB routing for React and Preact. Nothing else but HOOKS.
Stars: ✭ 3,654 (+1126.17%)
Mutual labels: router
mpvue-router-patch
在 mpvue 中使用 vue-router 兼容的路由写法
安装
npm i mpvue-router-patch
使用
// main.js
import Vue from 'vue'
import MpvueRouterPatch from 'mpvue-router-patch'
Vue.use(MpvueRouterPatch)
API
支持以下列出的方法及属性
Router 实例
属性
- $router.app
当前页面的 Vue 实例
- $router.mode
路由使用的模式,固定值 history
- $router.currentRoute
当前路由对应的路由信息对象,等价于 $route
方法
- $router.push(location, onComplete?, onAbort?, onSuccess?)
跳转到应用内的某个页面,mpvue.navigateTo
、mpvue.switchTab
及 mpvue.reLaunch
均通过该方法实现,location
参数支持字符串及对象两种形式,跳转至 tabBar
页面或重启至某页面时必须以对象形式传入
// 字符串
router.push('/pages/news/detail')
// 对象
router.push({ path: '/pages/news/detail' })
// 带查询参数,变成 /pages/news/detail?id=1
router.push({ path: '/pages/news/detail', query: { id: 1 } })
// 切换至 tabBar 页面
router.push({ path: '/pages/news/list', isTab: true })
// 重启至某页面,无需指定是否为 tabBar 页面,但 tabBar 页面无法携带参数
router.push({ path: '/pages/news/list', reLaunch: true })
- $router.replace(location, onComplete?, onAbort?, onSuccess?)
关闭当前页面,跳转到应用内的某个页面,相当于 mpvue.redirectTo
,location
参数格式与 $router.push
相似,不支持 isTab
及 reLaunch
属性
- $router.go(n)
关闭当前页面,返回上一页面或多级页面,n
为回退层数,默认值为 1
- $router.back()
关闭当前页面,返回上一页面
路由信息对象
属性
- $route.path
字符串,对应当前路由的路径,总是解析为绝对路径,如 /pages/news/list
- $route.params
空对象,小程序不支持该属性
- $route.query
一个 key/value 对象,表示 URL 查询参数。例如,对于路径 /pages/news/detail?id=1
,则有 $route.query.id == 1
,如果没有查询参数,则是个空对象。
- $route.hash
空字符串,小程序不支持该属性
- $route.fullPath
完成解析后的 URL,包含查询参数和 hash 的完整路径
- $route.name
当前路由的名称,由 path
转化而来
Note that the project description data, including the texts, logos, images, and/or trademarks,
for each open source project belongs to its rightful owner.
If you wish to add or remove any projects, please contact us at [email protected].