On the problem of vue Navigation Guard

from the first page to the second routing page, the value of from is printed out through the component guard beforeRouteEnter on the second routing page, as shown in the following figure


from

is empty and can not get the information of the first page stack. How to solve this problem


if you refresh on the second page, you will definitely not find out which page it came from.
I suggest you, when the first page goes to the second page, for example, / first-> / second
passes the routing ID of the first page to the Url of the second page, as follows:
/ second?from=first


js although you can pass window.history.back () , window.history.go () performs a browser history jump operation. But there is no way to get the browser's real History list. The reason why
vue-router can implement front-end routing and give your navigation guards form , to is only due to the fact that the front-end single-page application does not really jump to record the history path.
when you refresh your page, the data recorded by it is lost, and there is no way to get the data through the browser. It can only start all over again. Of course, you can't get the last page form .

  • Why is vue $on not triggered?

    elementuidispatch dispatch Why is it triggered only in the hook function of created, but mounted does not trigger $on, but 668 has output? it is useless for me to comment on the $on of created, why is the $on of mounted not triggered? I saw that el...

Menu