在vue-router里,参数分两种,1、动态路径参数;2、查询参数
动态路径参数,
这需要按路由文档里配置,例如:/user/:username
获取动态路径参数时,用 this.$router.params 来获取动态参数值。
查询参数
路径里的查询参数,不需要在路由里设置,可以直接放在路由里。例如 http://localhost:8000/index.htm#/hello?test=1232
获取查询参数,可以用this.$router.query来获取查询参数值
在vue-router里,参数分两种,1、动态路径参数;2、查询参数
动态路径参数,
这需要按路由文档里配置,例如:/user/:username
获取动态路径参数时,用 this.$router.params 来获取动态参数值。
查询参数
路径里的查询参数,不需要在路由里设置,可以直接放在路由里。例如 http://localhost:8000/index.htm#/hello?test=1232
获取查询参数,可以用this.$router.query来获取查询参数值