主要记录vue路由问题,基于vue^2.3.3

路由动态跳转

      
      
this.$router.push({ path: 'studentEmployerList', query:{ id: '12'}}) //动态跳转页面路径
this.$router.replace({ path: 'studentEmployerList'}) //与push相同,但不会留下历史记录
this,$router.go( 3) //返回到路劲的第n个历史记录

子路由和路由重定向

      
      
{
path: '/',
component: home,
redirect: '/list'
children: [
{ path: 'list', component: list},
{ path: 'detail', component: detail}
]
}

query和params传递参数的区别

      
      
query:后的键值被放在url中,形式类似以get,明文可以,query传输的值页面刷新后不会被清除;
params:的键值对在请求头header中可以查看到,不放在url中,params传输的值页面刷新后会被清除;