首页 > 技术文章 > vue 路由跳转传参

tlfe 2020-06-05 15:14 原文

第一种方式:

<router-link :to="{path:'/my_details/my_comment',query:{userInfo:userInfo.headImage}}" >
  <img src="@/assets/img/my/my_weixin.png" alt />
  <h5>我的评论</h5>
</router-link>

 

第二种方式:

<div class="my_good_friend_info" @click="chitchat(item.id)">
   <img src="@/assets/img/my/viewhistory2.png" alt />
</div>
 
chitchat(val) {
   this.$router.push({ path: "/my_details/my_chat", query: { id: val } });
},

 

使用都是一样的:

这样打印,你就知道怎么用了
 
console.log(this.$route.query,'-----------------')

 

推荐阅读