From d7469b962218f1ddb2bc0f8d6995f2f190d3ed07 Mon Sep 17 00:00:00 2001 From: Azure <983547216@qq.com> Date: Tue, 2 Jun 2026 12:36:44 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=9A=82=E5=AD=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/assets/style/index.scss | 3 - src/components/HelloWorld.vue | 81 +------------------------ src/layouts/authPage/authPageLayout.vue | 11 ++++ src/layouts/authPage/index.ts | 1 + src/main.ts | 2 + src/router/routes/index.ts | 28 ++++++++- src/views/auth/login.vue | 7 +++ src/views/auth/register.vue | 5 ++ vite.config.ts | 3 +- 9 files changed, 56 insertions(+), 85 deletions(-) create mode 100644 src/layouts/authPage/authPageLayout.vue create mode 100644 src/layouts/authPage/index.ts create mode 100644 src/views/auth/login.vue create mode 100644 src/views/auth/register.vue 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 @@ - - - - - - + Get started Edit src/App.vue and save to test HMR Count is {{ count }} - - - - - - - - - Documentation - Your questions, answered - - - - - Explore Vite - - - - - - Learn more - - - - - - - - - Connect with us - Join the Vite community - - - - - - - GitHub - - - - - - - - Discord - - - - - - - - X.com - - - - - - - - Bluesky - - - - - - - - + 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))
Edit src/App.vue and save to test HMR
src/App.vue
HMR
Your questions, answered
Join the Vite community
Connect with us
-Join the Vite community
---
-
-
- GitHub
-
-
- -
-
-
- Discord
-
-
- -
-
-
- X.com
-
-
- -
-
-
- Bluesky
-
-
-
-