A mobile website has tested login restrictions on a page. If you are not logged in, you will go to the login page. However, when you reach the login page and press the return key, you can still return to the first page without reading any data or pictures. How can I do this? When he goes back, he refreshes the web page instead of reading the cached website
The window.location.replace() parameter writes the routing address you want to jump to (this page will not generate a cache, and the browser will not have a back option. If you need to generate a back option, replace "replace" with assign);
If you use vue-router in your project, you can use router.beforeEach
Refer to the code below
https://github.com/ycloud/cno...
If vue-router is not used, you can put the login judgment in beforeCreate for detection