From 78a477be3c507d5b280a89a243e2f4e252628580 Mon Sep 17 00:00:00 2001
From: wzy-warehouse <18135009705@163.com>
Date: Tue, 7 Apr 2026 21:22:31 +0800
Subject: [PATCH] =?UTF-8?q?=E9=85=8D=E7=BD=AE=E5=BC=80=E5=8F=91/=E7=94=9F?=
=?UTF-8?q?=E4=BA=A7=E7=8E=AF=E5=A2=83?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.env.development | 3 +++
.env.production | 2 ++
env.d.ts | 59 ++++++++++++++++++++++++++++++++++++++++++++++++
vite.config.ts | 1 +
4 files changed, 65 insertions(+)
create mode 100644 env.d.ts
diff --git a/.env.development b/.env.development
index dfcd07f..1e1a148 100644
--- a/.env.development
+++ b/.env.development
@@ -1,2 +1,5 @@
NEW_FILE_CODE
+
VITE_BACKEND_BASE_URL=http://localhost:8081
+
+START_PORT=80
\ No newline at end of file
diff --git a/.env.production b/.env.production
index dea87c2..92783b3 100644
--- a/.env.production
+++ b/.env.production
@@ -1,2 +1,4 @@
NEW_FILE_CODE
VITE_BACKEND_BASE_URL=http://localhost:8080
+
+START_PORT=81
\ No newline at end of file
diff --git a/env.d.ts b/env.d.ts
new file mode 100644
index 0000000..9f6f7e4
--- /dev/null
+++ b/env.d.ts
@@ -0,0 +1,59 @@
+NEW_FILE_CODE
+///
+
+declare module '*.vue' {
+ import type { DefineComponent } from 'vue'
+ const component: DefineComponent<{}, {}, any>
+ export default component
+}
+
+// 声明环境变量类型
+interface ImportMetaEnv {
+ readonly VITE_BACKEND_BASE_URL: string
+ readonly START_PORT: number
+ readonly MODE: string
+ readonly DEV: boolean
+ readonly PROD: boolean
+ readonly SSR: boolean
+}
+
+interface ImportMeta {
+ readonly env: ImportMetaEnv
+}
+
+// 声明 CSS 模块类型
+declare module '*.css' {
+ const content: Record
+ export default content
+}
+
+// 声明静态资源类型
+declare module '*.svg' {
+ const content: string
+ export default content
+}
+
+declare module '*.png' {
+ const content: string
+ export default content
+}
+
+declare module '*.jpg' {
+ const content: string
+ export default content
+}
+
+declare module '*.jpeg' {
+ const content: string
+ export default content
+}
+
+declare module '*.gif' {
+ const content: string
+ export default content
+}
+
+declare module '*.webp' {
+ const content: string
+ export default content
+}
diff --git a/vite.config.ts b/vite.config.ts
index e27b8a4..9140e29 100644
--- a/vite.config.ts
+++ b/vite.config.ts
@@ -31,6 +31,7 @@ export default defineConfig(({ mode }) => {
},
},
server: {
+ port: Number(env.START_PORT),
proxy: {
'/api': {
target: backendBaseUrl,