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!!

 

  

  
posted @ 2018-07-31 17:58  lijuntao  阅读(272)  评论(0编辑  收藏  举报
TOP