vue-router路由跳转参数的传递和接收
2018-10-09 本文已影响0人
子涵_520
路由跳转的方式(编程式,声明式)
1.编程式
this.$router.push()有四种方式
// 字符串
this.$router.push('路径')
// 对象
this.$router.push({path:"×××××?name"+this.name})
// 命名的路由
this.$router.push({name:"",params:{key:value}})
(name指的是路由配置文件中的name)
![](https://img.haomeiwen.com/i7208441/175bd20c5682a6e8.png)
//带参数查询
this.$router.push({path:"",query:{key:value}})
获取参数
路由传递的参数通过this.route.query