Vue-router路由参数传递

this.$router.push('path')    //直接的路由跳转

this.$router.push({name:'path',params:{'a':1,'b':2}})        //根据路由名称跳转,传递参数
this.$route.params.a     //取参数a
this.$route.params.b    //取参数b

this.$router.push({path:'/path',query:{'a':1,'b':2}})        //根据路由路径跳转,传递参数是拼接到URL上的如:/path?a=1&b=2

this.$route.query.a    //取参数a
this.$route.query.b    //取参数b

  

猜你喜欢

转载自www.cnblogs.com/NoteBook3013/p/12105610.html