Reprinted: https://www.jb51.net/article/143910.htm
Objective: To achieve the unregistered Jump
Example: directly in the url address bar ..... / home, but after this landing page requirements need to enter a value judgment on to the local cache stored by the judge after landing token, if not jump to the login page some words will open.
Icon:
1, direct input in the url address bar http://127.0.0.1:9000/#/home , but the page will jump directly to the login page, and will bring parameters.
vue-router need to install
First, configure routing
/src/router/index.js
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
|
Then configure main.js
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
|
Here are deposited login token
Login ## so it will jump directly to the login page.
Achieve a successful login page and then jump back to the start input, it is necessary to use the value passed behind.
If you jump to the page containing redirect just entered.
Note: If you save user data to localstorage is unreasonable, given here only an idea, you do not empty your browser if data after landing, token there has been a judge will fail.