Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

The method of vue Route Jump router-link to clear History

2025-04-02 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly introduces the relevant knowledge of the method of vue route jump router-link to clear history records, the content is detailed and easy to understand, the operation is simple and fast, and has a certain reference value. I believe that you will gain something after reading this article on the method of vue route jump router-link to clear history records. Let's take a look at it.

Route Jump router-link clears History

1. When we talk about route hopping in the vue project, the first thing we think of is the router-link tag and the this.$router.push function.

The implementation principle of router-link is the same as that of this.\ $router.push. When you click router-link, the internal call is this.$router.push.

The 2.this.\ $router.push method adds a new record to the history stack, so when the user clicks the browser back button, it goes back to the previous URL.

So how do we get rid of the history when we use route jumps?

The official documentation provides the following three ways

1. Remove the history when using the router-link tag: add the replace attribute

Project list

two。 Remove the history when using the this.\ $router.push tag: add the replace attribute, and the default value is false

This.$router.push ({path:'/ project_selection',replace:true})

3. Remove the history when using the this.\ $router.replace tag

This.$router.replace ({path:'/ project_selection'})

All the content comes from the official website: vue routing core plug-in

Vue does not record history after jumping

Vue route hopping is usually done using push.

This.$router.push ({path: "/ testTeam/testTeam",})

If there is a special need, the page will not be recorded in the history after the page is redirected. Just change push to replace.

This is the end of the article this.$router.replace ({path:'/ project_selection'}) on "the method of vue Route Jump router-link to clear History". Thank you for reading! I believe that everyone has a certain understanding of the knowledge of "vue routing jump router-link clearing history method". If you want to learn more knowledge, you are welcome to follow the industry information channel.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report