feat: 添加pinia、vue-router、tailwindcss

This commit is contained in:
2026-06-02 11:37:15 +08:00
parent 0ba412b194
commit 239f6a4891
21 changed files with 752 additions and 308 deletions

19
src/router/guard.ts Normal file
View File

@@ -0,0 +1,19 @@
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 };

16
src/router/index.ts Normal file
View File

@@ -0,0 +1,16 @@
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 };

View File

@@ -0,0 +1,5 @@
import HelloWorld from "@/components/HelloWorld.vue";
const routes = [{ path: "/", component: HelloWorld }];
export default routes;