$router与$route,前者似路由的发送者,后者似路由的接受者
//$router 路由跳转
this.$router.push();
this.$router.replace();
this.$router.go();
this.$router.back();
this.$router.forward();
//$route 路由参数接受
this.$route.params.id
this.$route.query.id
params与query,前者的参数在地址栏Url中隐藏键,后者显示键
this.$router.push({ name: 'user', params: { id: '123' }});
// http://xxxxx.com/user/123
this.$router.push({ path: 'user', query: { id: '123' }});
// http://xxxxx.com/user?id=123
!注意的一点是:params传递参数需要在路由文件中设置下地址参数
path: '/user/:id?',
component: xxxx