Vue.js中使用this.$router.push参数获取

2018-01-29 10:02 阅读 3,444 次 评论 0 条

传递参数的方法:
1.Params

由于动态路由也是传递params的,所以在 this.$router.push() 方法中path不能和params一起使用,否则params将无效。需要用name来指定页面。

及通过路由配置的name属性访问

在路由配置文件中定义参数:

通过name获取页面,传递params:

在目标页面通过this.$route.params获取参数:

2.Query

页面通过path和query传递参数,该实例中row为某行表格数据

在目标页面通过this.$route.query获取参数:

this.$route.query.row.xxx

转载自:http://blog.csdn.net/qq_15646957/article/details/78070862
版权声明:本文著作权归原作者所有,欢迎分享本文,谢谢支持!
转载请注明:Vue.js中使用this.$router.push参数获取 | 雨晨博客

发表评论


表情