diff --git a/src/assets/style/index.scss b/src/assets/style/index.scss index efdad95..df2c354 100644 --- a/src/assets/style/index.scss +++ b/src/assets/style/index.scss @@ -1,5 +1,2 @@ /** 全局样式 */ @use "./global.scss"; - -/** 引入tailwindcss */ -@import "./tailwind.css"; diff --git a/src/components/HelloWorld.vue b/src/components/HelloWorld.vue index 2fe0d76..7962415 100644 --- a/src/components/HelloWorld.vue +++ b/src/components/HelloWorld.vue @@ -1,93 +1,16 @@ + diff --git a/src/layouts/authPage/authPageLayout.vue b/src/layouts/authPage/authPageLayout.vue new file mode 100644 index 0000000..16b079e --- /dev/null +++ b/src/layouts/authPage/authPageLayout.vue @@ -0,0 +1,11 @@ + + + + + diff --git a/src/layouts/authPage/index.ts b/src/layouts/authPage/index.ts new file mode 100644 index 0000000..ab47f73 --- /dev/null +++ b/src/layouts/authPage/index.ts @@ -0,0 +1 @@ +export { default as AuthPageLayout } from "./authPageLayout.vue"; diff --git a/src/main.ts b/src/main.ts index fe57e04..09254cc 100644 --- a/src/main.ts +++ b/src/main.ts @@ -4,6 +4,8 @@ import { router } from "@/router"; import useNaiveUi from "@/assets/naiveUI/useNaiveUi.ts"; import App from "./App.vue"; +/** 引入 Tailwind CSS(必须在 SCSS 之前,确保 Vite 插件能正确拦截处理) */ +import "@/assets/style/tailwind.css"; import "@/assets/style/index.scss"; const app = createApp(App); diff --git a/src/router/routes/index.ts b/src/router/routes/index.ts index c079c94..4e7dd59 100644 --- a/src/router/routes/index.ts +++ b/src/router/routes/index.ts @@ -1,5 +1,29 @@ -import HelloWorld from "@/components/HelloWorld.vue"; +import type { RouteRecordRaw } from "vue-router"; -const routes = [{ path: "/", component: HelloWorld }]; +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; diff --git a/src/views/auth/login.vue b/src/views/auth/login.vue new file mode 100644 index 0000000..a4a8392 --- /dev/null +++ b/src/views/auth/login.vue @@ -0,0 +1,7 @@ + + + + + diff --git a/src/views/auth/register.vue b/src/views/auth/register.vue new file mode 100644 index 0000000..ca9b9e4 --- /dev/null +++ b/src/views/auth/register.vue @@ -0,0 +1,5 @@ + + + + + diff --git a/vite.config.ts b/vite.config.ts index d37700a..fc1fa9d 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -1,10 +1,11 @@ import { defineConfig } from "vite"; import vue from "@vitejs/plugin-vue"; import { fileURLToPath, URL } from "node:url"; +import tailwindcss from '@tailwindcss/vite' // https://vite.dev/config/ export default defineConfig({ - plugins: [vue()], + plugins: [vue(), tailwindcss()], resolve: { alias: { "@": fileURLToPath(new URL("./src", import.meta.url))