this.$router跳转 带参数
时间: 2023-09-10 09:06:12 浏览: 102
在使用`this.$router`进行跳转并带参数的情况下,有两种方式可以传递参数。第一种方式是通过params传递参数,对应的代码如下:
```
this.$router.push({
name: '路由的name',
params: {
key1: value1,
key2: value2
}
})
```
这样,在目标页面中可以通过`this.$route.params.key1`和`this.$route.params.key2`来获取传递的参数。<span class="em">1</span><span class="em">2</span><span class="em">3</span>
#### 引用[.reference_title]
- *1* *2* *3* [VueRouter: this.$route.push跳转,携带参数](https://blog.csdn.net/u014635374/article/details/116162950)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v92^chatsearchT0_1"}}] [.reference_item style="max-width: 100%"]
[ .reference_list ]
阅读全文