this.$router.replace原地址
时间: 2023-08-21 18:13:10 浏览: 99
this.$router.replace是Vue Router提供的一个方法,用于进行路由跳转并替换当前的路由记录。与this.$router.push不同的是,this.$router.replace不会在路由栈中添加新的记录。当使用this.$router.replace进行路由跳转时,原地址会被替换为新的地址,而不会在浏览器的历史记录中留下原地址的记录。这意味着,当用户点击浏览器的返回按钮时,不会返回到原地址,而是直接返回到上一个页面。\[2\]所以,this.$router.replace可以用于在不需要保留原地址记录的情况下进行路由跳转。
#### 引用[.reference_title]
- *1* [Vue--Router--this.$router.replace()、push()、go()的区别](https://blog.csdn.net/feiying0canglang/article/details/126415877)[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^insert_down1,239^v3^insert_chatgpt"}} ] [.reference_item]
- *2* [详细总结this.$router.push与this.$router.replace](https://blog.csdn.net/qq_45791799/article/details/122453567)[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^insert_down1,239^v3^insert_chatgpt"}} ] [.reference_item]
- *3* [Vue中this.$router.replace和this.$router.push的区别](https://blog.csdn.net/weixin_50723416/article/details/119531773)[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^insert_down1,239^v3^insert_chatgpt"}} ] [.reference_item]
[ .reference_list ]
阅读全文