The method of vue Route Jump router-link to clear History
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.