vue.js 接收url参数

Posted miaomiaotab

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了vue.js 接收url参数相关的知识,希望对你有一定的参考价值。

1) 路由配置传参方式
在配置路由时 例如 "/firewall/authorize/:uid/:uname/:token"
页面url为 http://XXX.com/firewall/authorize/23/zhangman/232454

js 接收方式 this.$route.params.uid,
2) ?传参方式
例 http://XXX.com/firewall/authorize?uid=12&uname=zhangman&token=23243
js 接收方式 this.$route.query.uid

 
 
最终方案
 
    <box v-for="info in list" gap="20px 10px" :key="info.id">
      <x-button class="btn" type="primary" @click.native="detailPage(info)" v-model="info.infoType">{{info.infoType}}</x-button>
    </box>

  

 
 
      detailPage(info) {
        this.$router.push({path: "/monitor-detail", query: {monitoringId: info.id}});
      }

  

重要参考:

 

以上是关于vue.js 接收url参数的主要内容,如果未能解决你的问题,请参考以下文章