Vue routing parameter page refresh the passed parameters disappear

The following problems were discovered due to business needs:

Business description:
Click on the Junior Brother’s Go to score, and then use the routing pass to pass the Junior Brother’s id. Then perform an operation on the senior scoring page.

problem found:
After refreshing the page on the Junior Brother page, you will find that there is no data. The cause investigation found that after the page is refreshed, the id passed by the route is gone. As a result, no data is requested, and some data manipulation requests cannot be sent.

problem solved:
Store the data obtained by routing parameters locally.

window.sessionStorage.setItem("sdId",this.$route.params.userId)

Insert picture description here
Insert picture description here

Guess you like

Origin blog.csdn.net/weixin_43131046/article/details/115009394