All Projects → geminate → megalo-router-patch

geminate / megalo-router-patch

Licence: MIT license
在 megalo 中使用 vue-router 的路由写法

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to megalo-router-patch

wwvue-cli
vue-cli升级版脚手架,应有尽有的开箱即用方法及配置,没有花里胡哨的晦涩难懂的操作,上手成本极低,现已新增simple(极简模式)、vue3和iview-template,是个很不错的垫脚石,来不及解释了赶紧上车😊😘
Stars: ✭ 15 (+0%)
Mutual labels:  vue-router
vue-webpack-boilerplate
A webpack boilerplate with vue-loader, axios, vue-router and vuex
Stars: ✭ 51 (+240%)
Mutual labels:  vue-router
meal-ticket
前端基于webpack+vue+vux,后端基于express+lowdb。有了这些,开发一个项目将会变得很轻松。
Stars: ✭ 19 (+26.67%)
Mutual labels:  vue-router
Human-Resources-Management-System
Human Resources Management System Project
Stars: ✭ 32 (+113.33%)
Mutual labels:  vue-router
Vue2.x-mobileSystem
基于Vue2.0的移动端项目,项目没有使用vue-cli,全部手写,让小白更容易学习理解
Stars: ✭ 72 (+380%)
Mutual labels:  vue-router
vue-automation
一款开箱即用的 Vue 项目模版,基于 Vue 2.x
Stars: ✭ 31 (+106.67%)
Mutual labels:  vue-router
kugou
multiple implementations for kugou music
Stars: ✭ 25 (+66.67%)
Mutual labels:  vue-router
shopping-cart
A vue.js project for shopping cart.
Stars: ✭ 57 (+280%)
Mutual labels:  vue-router
vue-ssr-lessons
包教会的 vue 服务端渲染课程
Stars: ✭ 81 (+440%)
Mutual labels:  vue-router
vue-seo-friendly-spa-template
Vue.js PWA/SPA template initially scaffolded with vue-cli and configured for SEO. Makes use of prerendering and other techniques/packages in order to achieve a perfect "Lighthouse Score".
Stars: ✭ 41 (+173.33%)
Mutual labels:  vue-router
vue-2.x-boilerplate
A Vue.js 2.x Boilerplate with Vuex, vue-router AND Bulma
Stars: ✭ 25 (+66.67%)
Mutual labels:  vue-router
vue-mall
vue企业级商城练手项目并且提供接口唷
Stars: ✭ 14 (-6.67%)
Mutual labels:  vue-router
vue2-vue-router2-webpack
http://www.qinshenxue.com/article/20161106163608.html
Stars: ✭ 14 (-6.67%)
Mutual labels:  vue-router
vue-weibo
用Vue.js及相关插件仿制的新浪微博移动版(m.weibo.cn)🌺
Stars: ✭ 69 (+360%)
Mutual labels:  vue-router
vue3-docs
vue中文社区,vue3 中文文档
Stars: ✭ 180 (+1100%)
Mutual labels:  vue-router
vue2.0-SellPosSystem
vue2.0实战项目——简单的快餐店系统
Stars: ✭ 35 (+133.33%)
Mutual labels:  vue-router
Vue-CAMP
VueJS
Stars: ✭ 16 (+6.67%)
Mutual labels:  vue-router
mall-app-vant
有来商城youlai-mall移动APP端,技术栈:Vant,已计划变更使用uni-app适配Android、IOS端开发。
Stars: ✭ 33 (+120%)
Mutual labels:  vue-router
vue3-chat
2021👨‍🎓Vue2/3全家桶 + Koa+Socket+Vant3前后端分离移动端聊天应用。vue+node全栈入门项目
Stars: ✭ 46 (+206.67%)
Mutual labels:  vue-router
Laravel-Vue-SPA-template
Template for Single Page Applications built with Laravel and Vue.
Stars: ✭ 22 (+46.67%)
Mutual labels:  vue-router

megalo-router-patch

megalo 中使用 vue-router 的路由写法, 可自动转换为对应小程序的路由写法。

安装

npm i megalo-router-patch

使用

// main.js
import Vue from 'vue'
import MegaloRouterPatch from 'megalo-router-patch'

Vue.use(MegaloRouterPatch)

Api

this.$router

属性

  • this.$router.app

当前页面实例

  • this.$router.currentRoute

当前页面的路由信息对象,和 this.$route 相同

方法

  • this.$router.push(location, onComplete, onAbort, onSuccess)
// 跳转至某页面(字符串形式)   --->   navigateTo()
this.$router.push('/pages/home/index')

// 跳转至某页面(对象形式)   --->   navigateTo()
this.$router.push({ path: '/pages/home/index' })

// 跳转至某页面(带参数)   --->   navigateTo()
this.$router.push({ path: '/pages/home/index', query: { id: 1 } })

// Tab 切换   --->   switchTab()
this.$router.push({ path: '/pages/home/index', isTab: true })

// 重启至某页面   --->   reLaunch()
this.$router.push({ path: '/pages/home/index', reLaunch: true })
  • this.$router.replace(location, onComplete, onFail, onSuccess)
// 关闭当前页面,跳转至某页面   --->   redirectTo()
this.$router.replace('/pages/home/index')
  • this.$router.go(delta)
// 返回多级页面   --->   navigateBack()
this.$router.go(4)
  • this.$router.back()
// 返回上一页面   --->   navigateBack()
this.$router.back()

this.$route

属性

  • this.$router.path

当前页面的路径字符串

"/pages/home/index"
  • this.$router.query

当前页面的参数对象

{
    name: geminate,
    age: 23
}
  • this.$router.fullPath
"/pages/home/index?name=geminate&age=23"

当前页面的完整路径,包含查询参数等

  • this.$router.name

自动生成的页面名称

"pagesHomeIndex"

TODO

  • 导航守卫

参考自 mpvue-router-patch

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].