清空
This commit is contained in:
@@ -1,19 +0,0 @@
|
||||
import type { Router } from "vue-router";
|
||||
|
||||
/**
|
||||
* 通用路由守卫
|
||||
*/
|
||||
function setupCommonGuard(router: Router) {
|
||||
// @ts-ignore
|
||||
router.beforeEach(async (to, from) => {
|
||||
// TODO: 路由守卫
|
||||
return true;
|
||||
});
|
||||
}
|
||||
|
||||
// 路由守卫
|
||||
function createRouterGuard(router: Router) {
|
||||
setupCommonGuard(router);
|
||||
}
|
||||
|
||||
export { createRouterGuard };
|
||||
@@ -1,16 +0,0 @@
|
||||
import { createMemoryHistory, createRouter } from "vue-router";
|
||||
import routes from "./routes";
|
||||
import { createRouterGuard } from "@/router/guard.ts";
|
||||
|
||||
/**
|
||||
* 创建路由实例
|
||||
*/
|
||||
const router = createRouter({
|
||||
history: createMemoryHistory(),
|
||||
routes
|
||||
});
|
||||
|
||||
// 创建路由守卫
|
||||
createRouterGuard(router);
|
||||
|
||||
export { router };
|
||||
@@ -1,29 +0,0 @@
|
||||
import type { RouteRecordRaw } from "vue-router";
|
||||
|
||||
const routes: RouteRecordRaw[] = [
|
||||
{
|
||||
path: "/",
|
||||
name: "Root",
|
||||
component: () => import("@/components/HelloWorld.vue"),
|
||||
children: []
|
||||
},
|
||||
{
|
||||
path: "/auth",
|
||||
name: "Authentication",
|
||||
component: () => import("@/layouts/authPage/authPageLayout.vue"),
|
||||
children: [
|
||||
{
|
||||
path: "login",
|
||||
name: "Login",
|
||||
component: () => import("@/views/auth/login.vue")
|
||||
},
|
||||
{
|
||||
path: "register",
|
||||
name: "Register",
|
||||
component: () => import("@/views/auth/register.vue")
|
||||
}
|
||||
]
|
||||
}
|
||||
];
|
||||
|
||||
export default routes;
|
||||
Reference in New Issue
Block a user