mpvue 小程序常用的一些插件 路由跳转mpvue-router-patch,数据请求flyio,vuex

路由跳转 mpvue-router-patch

方法
$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()
关闭当前页面,返回上一页面

官网 :https://www.npmjs.com/package/mpvue-router-patch