1. Routing configuration and jump without parameters
//Route configuration:
{
name: "a",
path: "/a",
component: a
}
Page jump:
this.$router.push('/a');
this.$router.push({path:'/a'});
this.$router.push({name:'a'})
2. Routing configuration with parameters and page jumping and receiving parameters
//Route configuration:
{
name: "a",
path: "/a/:userid",
component: a
}
//Page jump:
this.$router.push({name:'a',params:{userid:123}}); 接收: this.$route.params.userid
this.$router.push({path:'/a',query:{userid:123}}) 接收: this.$route.query.userid
this.$router.push({path:'/a',params{userid:123}}) error, if provided
path
,
params
it will be ignored
this.$router.push({path:'/a/123'}); 接收: this.$route.params.userid
this.$router.push({path:'/a?userid=123'}) Receive: this.$route.query.userid ----- The routing configuration path of this item: '/a', no need to bring parameter