1, jump through router-link, transmission mode:
Passing parameters using query routing path must be introduced,
Use pass parameters params, the route must be introduced name
<router-link :to="{path: '/home', query: {key: 'hello', value: 'world'}}">
<button>跳转</button>
</router-link>
Jump address ====> / home? Key = hello & value = world
The value ====> this. $ Route.query.key
<router-link :to="{name: '/home', params: {key: 'hello', value: 'world'}}">
<button>跳转</button>
</router-link>
Jump address ====> / home ??? (temporarily not used)
The value ====> this. $ Route.params.key
2, $ router mode Jump
this.$router.path({
path: '/detail',
query: {
name: 'admin',
code: 10021
}
});
Jump address ====> / detail? Name = admin & code = 10021
The value ====> this. $ Route.query.name
this.$router.path({
name: 'detail',
params: {
code: 10021
}
});
Jump address ====> / detail / 10021
The value ====> this. $ Route.params.code