vue params和query传参的用法和区别

this.$router.push({
   name:"detail",
   params:{
    name:'nameValue',
    code:10011
 }
});

刚才已经说了,query要用path来引入,params要用name来引入,接收参数都是类似的,分别是this.$route.query.name和this.$route.params.name。

注意接收参数的时候,已经是$route而不是$router了哦!!

猜你喜欢

转载自blog.csdn.net/pansuyong/article/details/81449925