vue-router2
安装
引入这种方式,但一般用倾向于用webpack模块化的方法
,为了让package.json中打上一个log,后面加上--save-dev
import Vue from 'vue'; import VueRouter from 'vue-router'; Vue.use(VueRouter)
重定向
const router = new VueRouter({ routes:[{ path:'/a',redirect:'/b' }] })
const router = new VueRouter({ routes:[{ path:'/a',redirect:{name:'foo'} }] })
const router = new VueRouter({ routes:[{ path:'/a',redirect:to=>{ //方法接收 目标路由 作为参数 //return 重定向 字符串路径或者路径对象 } }] })
动态路由匹配
Vuex
来源:博客园
作者:solaris-wwf
链接:https://www.cnblogs.com/solaris-wwf/p/11781527.html