No history records are recorded after vue jump
In general, push is used.
this.$({ path: "/testTeam/testTeam", });
If it is a special requirement, the page will not be recorded in the history after jumping, just change push to replace.
this.$({path: '/project_selection'})
vue-router rollback does not record history
Scene description
For single-page applications, there are often scenes where you access a certain page after logging in. for example
/index -> /login -> /page1
However, when page1 returns to the previous page, it will return to the login page. The fallback path is
/page1-> /login -> /index
Therefore, it is necessary to perform history processing of skipping the login page.
Processing Solution
-link + history
<template> loginPage <router-link replace to="/page1">Access after loginpage1</router-link> </template>
At this time, the fallback path on page 1 is
/page1 -> /index
2. Programming jump
<template> loginPage <button @click="replaceJump">Access after loginpage1</button> </template> <script setup lang='ts'> import {useRouter} from 'vue-router' const router = useRouter(); // Pass full path jump const replaceJump = ()=>{ ('/page1') } </script> <style> </style>
The result is the same as above.
Other API jump
In addition, there are other instructions for using the router object to jump API as follows
/** * Go back in history if possible by calling `()`. Equivalent to * `(-1)`. */ back(): ReturnType<Router['go']>; /** * Go forward in history if possible by calling `()`. * Equivalent to `(1)`. */ forward(): ReturnType<Router['go']>; /** * Allows you to move forward or backward through the history. Calls * `()`. * * @param delta - The position in the history to which you want to move, * relative to the current page */ go(delta: number): void;
The above is personal experience. I hope you can give you a reference and I hope you can support me more.