router.push传参
时间: 2023-08-21 14:12:42 浏览: 121
router.push传参可以使用query和params两种方式。使用query方式传参,参数会显示在URL的查询参数中,页面刷新时数据不会丢失。可以通过路由的name匹配路由,使用this.$router.push({ name: 'routeName', query: { paramName: paramValue } })来传递参数。例如,使用this.$router.push({ name: 'seller-center-invoice-info', query: { id: row.id } })来传递id参数\[1\]。使用params方式传参,参数不会显示在URL中,页面刷新时数据会丢失。同样可以通过路由的name匹配路由,使用this.$router.push({ name: 'routeName', params: { paramName: paramValue } })来传递参数。例如,使用this.$router.push({ name: 'RoutePushEdit', params: { id: id, data: data } })来传递id和data参数\[2\]\[3\]。
#### 引用[.reference_title]
- *1* [this.$router.push的传参方式](https://blog.csdn.net/kawayiyy123/article/details/113616569)[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^v91^insertT0,239^v3^insert_chatgpt"}} ] [.reference_item]
- *2* *3* [vue路由$router.push()的三种传参方式](https://blog.csdn.net/qq_41206305/article/details/121494328)[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^v91^insertT0,239^v3^insert_chatgpt"}} ] [.reference_item]
[ .reference_list ]
阅读全文