最简单的方法就是location.reload(),但是用户体验不好
除此之外还有一种方法比较好
const createRouter = () => new VueRouter({
linkActiveClass: ‘active‘,
mode: ‘hash‘,
base: ‘./‘,
routes: constantRouterMap
});
const router = createRouter();
// 在addRoutes之前重置matcher
router.matcher = createRouter().matcher;
router.addRoutes(store.getters.addRouters);
原文:https://www.cnblogs.com/imjtzhang/p/13709166.html