On the problem of dynamically adding routing (appRoutes) and routing Guard (beforeEach) to vue-router

I now have two entrances to enter the project, but I need to show different pages according to the level of user. After I have successfully obtained the user, I add routes using the addRoutes method of vue-router, but I can"t get the to&&from, in the router.beforeEach method. Is there a way to get it

redirect

the route is not redirected!


you didn't jump. After you get success, you have to jump to the route you want to go

Menu