diff --git a/package.json b/package.json
index 2454ffb..653fd48 100644
--- a/package.json
+++ b/package.json
@@ -9,7 +9,8 @@
"preview": "vite preview"
},
"dependencies": {
- "vue": "^3.5.24"
+ "vue": "^3.5.24",
+ "vue-router": "^4.6.4"
},
"devDependencies": {
"@types/node": "^24.10.1",
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index 9c07302..fce1a47 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -11,6 +11,9 @@ importers:
vue:
specifier: ^3.5.24
version: 3.5.26(typescript@5.9.3)
+ vue-router:
+ specifier: ^4.6.4
+ version: 4.6.4(vue@3.5.26(typescript@5.9.3))
devDependencies:
'@types/node':
specifier: ^24.10.1
@@ -542,6 +545,9 @@ packages:
'@vue/compiler-ssr@3.5.26':
resolution: {integrity: sha512-lZT9/Y0nSIRUPVvapFJEVDbEXruZh2IYHMk2zTtEgJSlP5gVOqeWXH54xDKAaFS4rTnDeDBQUYDtxKyoW9FwDw==}
+ '@vue/devtools-api@6.6.4':
+ resolution: {integrity: sha512-sGhTPMuXqZ1rVOk32RylztWkfXTRhuS7vgAKv0zjqk8gbsHkJ7xfFf+jbySxt7tWObEJwyKaHMikV/WGDiQm8g==}
+
'@vue/devtools-core@8.0.5':
resolution: {integrity: sha512-dpCw8nl0GDBuiL9SaY0mtDxoGIEmU38w+TQiYEPOLhW03VDC0lfNMYXS/qhl4I0YlysGp04NLY4UNn6xgD0VIQ==}
peerDependencies:
@@ -909,6 +915,11 @@ packages:
vscode-uri@3.1.0:
resolution: {integrity: sha512-/BpdSx+yCQGnCvecbyXdxHDkuk55/G3xwnC0GqY4gmQ3j+A+g8kzzgB4Nk/SINjqn6+waqw3EgbVF2QKExkRxQ==}
+ vue-router@4.6.4:
+ resolution: {integrity: sha512-Hz9q5sa33Yhduglwz6g9skT8OBPii+4bFn88w6J+J4MfEo4KRRpmiNG/hHHkdbRFlLBOqxN8y8gf2Fb0MTUgVg==}
+ peerDependencies:
+ vue: ^3.5.0
+
vue-tsc@3.2.2:
resolution: {integrity: sha512-r9YSia/VgGwmbbfC06hDdAatH634XJ9nVl6Zrnz1iK4ucp8Wu78kawplXnIDa3MSu1XdQQePTHLXYwPDWn+nyQ==}
hasBin: true
@@ -1382,6 +1393,8 @@ snapshots:
'@vue/compiler-dom': 3.5.26
'@vue/shared': 3.5.26
+ '@vue/devtools-api@6.6.4': {}
+
'@vue/devtools-core@8.0.5(vite@7.3.1(@types/node@24.10.8))(vue@3.5.26(typescript@5.9.3))':
dependencies:
'@vue/devtools-kit': 8.0.5
@@ -1748,6 +1761,11 @@ snapshots:
vscode-uri@3.1.0: {}
+ vue-router@4.6.4(vue@3.5.26(typescript@5.9.3)):
+ dependencies:
+ '@vue/devtools-api': 6.6.4
+ vue: 3.5.26(typescript@5.9.3)
+
vue-tsc@3.2.2(typescript@5.9.3):
dependencies:
'@volar/typescript': 2.4.27
diff --git a/src/App.vue b/src/App.vue
index 2aaf251..0dac5a3 100644
--- a/src/App.vue
+++ b/src/App.vue
@@ -2,7 +2,7 @@
- holle word
+
diff --git a/src/main.ts b/src/main.ts
index 2425c0f..d7b13ac 100644
--- a/src/main.ts
+++ b/src/main.ts
@@ -1,5 +1,5 @@
-import { createApp } from 'vue'
-import './style.css'
-import App from './App.vue'
-
-createApp(App).mount('#app')
+import { createApp } from "vue";
+import App from "./App.vue";
+import router from "./router";
+const app = createApp(App);
+app.use(router).mount("#app");
diff --git a/src/router/index.ts b/src/router/index.ts
new file mode 100644
index 0000000..b3aa1ca
--- /dev/null
+++ b/src/router/index.ts
@@ -0,0 +1,15 @@
+import { createMemoryHistory, createRouter } from "vue-router";
+import HomeView from "@/views/home/index.vue";
+import AboutView from "@/views/login/index.vue";
+
+const routes = [
+ { path: "/", component: HomeView },
+ { path: "/login", component: AboutView },
+];
+
+const router = createRouter({
+ history: createMemoryHistory(),
+ routes,
+});
+
+export default router;
diff --git a/src/views/home/index.vue b/src/views/home/index.vue
new file mode 100644
index 0000000..ed36bc3
--- /dev/null
+++ b/src/views/home/index.vue
@@ -0,0 +1,6 @@
+
+
+ 首页
+ 登录
+
+
\ No newline at end of file
diff --git a/src/views/login/index.vue b/src/views/login/index.vue
new file mode 100644
index 0000000..b50ccbf
--- /dev/null
+++ b/src/views/login/index.vue
@@ -0,0 +1,5 @@
+
+
+ 登录页
+
+
\ No newline at end of file
diff --git a/tsconfig.app.json b/tsconfig.app.json
index 8d16e42..f8e6042 100644
--- a/tsconfig.app.json
+++ b/tsconfig.app.json
@@ -12,5 +12,5 @@
"noFallthroughCasesInSwitch": true,
"noUncheckedSideEffectImports": true
},
- "include": ["src/**/*.ts", "src/**/*.tsx", "src/**/*.vue"]
+ "include": ["src/**/*.ts", "src/**/*.tsx", "src/**/*.vue", "vite-env.d.ts"]
}
diff --git a/tsconfig.json b/tsconfig.json
index 1ffef60..fec8c8e 100644
--- a/tsconfig.json
+++ b/tsconfig.json
@@ -3,5 +3,11 @@
"references": [
{ "path": "./tsconfig.app.json" },
{ "path": "./tsconfig.node.json" }
- ]
+ ],
+ "compilerOptions": {
+ "baseUrl": ".",
+ "paths": {
+ "@/*": ["./src/*"]
+ }
+ }
}
diff --git a/vite-env.d.ts b/vite-env.d.ts
new file mode 100644
index 0000000..323c78a
--- /dev/null
+++ b/vite-env.d.ts
@@ -0,0 +1,7 @@
+///
+
+declare module '*.vue' {
+ import type { DefineComponent } from 'vue'
+ const component: DefineComponent<{}, {}, any>
+ export default component
+}