Vue
Routing parameters
For the summary of routing parameters, we hope to include and correct the mistakes. record
Vue
Two ways of routing parametersQuery and params
Routing parameters——-this.$route.query
< router link to = '/ home? Id = 123 & name = Zhangsan' > routing parameters query < / router link >
this.$route.query.id,
You’ll get 123, and thisapi
There is no need to configure routing rulesthis.$route.query.name,
You can get thisapi
There is no need to configure routing rules
Routing parameters——- `this.$route.params
< router link to = / home / 123 / Zhangsan > > routing parameters params < / router link >
this.$route.params.id
, you can’t get 123. You need to configure the routing rules as follows:{path:'/home/:id/:name',Component:home}
this.$route.params.name
And I can’t get itzhangsan
, you need to configure the routing rules as follows:{path:'/home/:id/:name',Component:home}