Why does vue jump to the home page after calling reload to refresh the page?

the login page is hidden under the app.vue and path, and a logout exit button is placed in the top menu of menu, that is, no matter which page you go to, you can log in (when you are not logged in) and exit (you have logged in).

after clicking the login button on the landing page, refresh the page through window.location.reload (); . The same is true for exit.

the problem now is that if you don"t click to log in or to exit on the home page, you will go to the home page after refreshing the page. Why?

Note: if router.js sets model=history mode, it will not

Mar.06,2021

Post your code
" to see


see if there are any routerBefore hooks. This will not happen if nothing is written.


window.location.reload (); this is the browser refresh. It is suggested to change it to this.$router.go (- 1), or this.$router.push ('specified address')


has this problem been solved?


is the a tag used? if you use it, you can remove it and try


solve the problem

Menu