vue query或params传参

1.query 

  传递端:

  this.$router.push({

    path:"/AccountFP",

    query:{

      id:row.id,

      userId:row.userId

    }

  })

  接受端:

  console.log(this.$route.query,id)

  console.log(this.$route.query,userId)

2:params

  1:传递端

  

this.$router.push({
        name:'xxx'
        params:{
          id:id
        }
      })

  接受:

this.$route.params.id

  注意:params传参,push里面只能是 name:'xxxx',不能是path:'/xxx',因为params只能用name来引入路由,如果这里写成了path,接收参数页面会是undefined!!

  

  
原文地址:https://www.cnblogs.com/lijuntao/p/9397358.html