vue2.0路由带参数跳转router-link :to方法

<router-link :to="{path:'industry_detail/', query:{id:item.id}}">
<el-button style="float: right; padding: 3px 0" type="text">
<span class="el-icon-d-arrow-right"></span>详情
</el-button>
</router-link>
路由跳转的方法

 path -> 是要跳转的路由路径,也可以是路由文件里面配置的 name 值,两者都可以进行路由导航
  1.  query -> 是通过 url 来传递参数的同样是key:value形式传递
  2. 在测试过程中发现params不能生效,只有query可以,所以这里我用了query
     
    在跳转后的页面用
    this.$route.query.id来获取参数
 

猜你喜欢

转载自www.cnblogs.com/wjhaaa/p/9333990.html