fix(router.ts): 添加注销时重置动态路由方法

This commit is contained in:
郝先瑞
2022-03-22 22:52:08 +08:00
parent 5f7728d094
commit a3a7eb6907

View File

@@ -1,4 +1,5 @@
import { createRouter, createWebHashHistory, RouteRecordRaw } from 'vue-router'
import useStore from "@/store";
export const Layout = () => import('@/layout/index.vue')
@@ -42,9 +43,9 @@ export const constantRoutes: Array<RouteRecordRaw> = [
name: 'Dashboard',
meta: { title: 'dashboard', icon: 'dashboard', affix: true }
}
]
]
}
// 外部链接
/*{
path: '/external-link',
@@ -108,13 +109,13 @@ const router = createRouter({
// 重置路由
export function resetRouter() {
//TODO
/* router.getRoutes().forEach((route) => {
const { permission } = useStore()
permission.routes.forEach((route) => {
const name = route.name
if (name) {
router.hasRoute(name) && router.removeRoute(name)
if (name && router.hasRoute(name)) {
router.removeRoute(name)
}
}) */
})
}
export default router