Vue uses addRoutes to execute router.beforeEach at least five times.

clipboard.png

Logic generally means that users generate routing tables through user token and generate new routes through addRoute, but get user information through token. Refreshing the page will execute router.beforeEach many times, resulting in multiple visits to the getUserInfo interface. I would like to ask how to avoid this problem


! Token is a cast type. Use ! token


to ask the landlord whether it has been solved? I have the same problem! It's hard now

Menu