routes.push
时间: 2023-10-31 21:06:33 浏览: 136
在Vue Router中,正确的方法是使用`router.push()`而不是`routes.push()`。`router.push()`用于在路由之间进行导航,可以接受不同类型的参数,包括字符串路径、对象描述的地址以及命名的路由等。例如:
- 字符串路径:`router.push('home')`
- 对象描述的地址:`router.push({ path: '/login', query: { stage: stage } })`
- 命名的路由:`router.push({ name: 'user', params: { userId: 123 } })`
这些示例展示了如何使用`router.push()`方法进行页面导航。请注意,这是Vue Router中的方法,而不是`routes.push()`。<span class="em">1</span><span class="em">2</span><span class="em">3</span>
#### 引用[.reference_title]
- *1* [前端笔记(11) Vue3 Router 编程式导航 router.push router.replace](https://blog.csdn.net/winterking3/article/details/126300881)[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^chatsearchT3_1"}}] [.reference_item style="max-width: 50%"]
- *2* *3* [Vue进阶(二十六):详解 router.push()](https://blog.csdn.net/sunhuaqiang1/article/details/85220888)[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^chatsearchT3_1"}}] [.reference_item style="max-width: 50%"]
[ .reference_list ]
阅读全文