router dynamic routing clearance
Reset the matcher to achieve the routing and restoration effect
Call resetRouter(router) when the user exits to restore the route
import Vue from 'vue' import Router from 'vue-router' import { constantRouterMap } from '...' //Import initialization router // Pass in the current routerexport function resetRouter (router) { const createRouter = () => new Router({ mode: 'history' routes: constantRouterMap }) // Replace the matcher of the current router with the initialized matcher = }
Attached matcher analysis:https:///article/
vue-router logout clears the route
The router does not provide a way to clear the data. We can write this
this.$({path: '/login'}); ();
The above is personal experience. I hope you can give you a reference and I hope you can support me more.