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}}); }
重要参考: