From c483b1912e746b8324e47948bcc15227a51c96f4 Mon Sep 17 00:00:00 2001 From: GJ Date: Fri, 4 Sep 2026 18:31:51 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E9=85=8D=E7=BD=AE=E5=B1=80=E5=9F=9F?= =?UTF-8?q?=E7=BD=91IP=E8=AE=BF=E9=97=AE=E4=B8=8E4312=E7=AB=AF=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 2 +- vite.config.ts | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index f3d2673..85825e8 100644 --- a/README.md +++ b/README.md @@ -21,7 +21,7 @@ cp .env.example .env pnpm dev ``` -浏览器访问 http://localhost:5173。先在后端仓库启动 `pnpm dev`,默认监听 **3412**。 +浏览器访问 http://localhost:4312。开发服务器会监听所有网卡,并在启动日志中输出局域网 IP;先在后端仓库启动 `pnpm dev`,默认监听 **3412**。 ```dotenv VITE_API_BASE_URL=/api diff --git a/vite.config.ts b/vite.config.ts index 27a1e75..b0869a5 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -10,7 +10,9 @@ export default defineConfig(({ mode }) => { plugins: [vue(), tailwindcss()], resolve: { alias: { '@': fileURLToPath(new URL('./src', import.meta.url)) } }, server: { - port: 5173, + /** 监听所有网卡,使 Vite 启动时输出可访问的局域网 IP。 */ + host: true, + port: 4312, proxy: { '/api': { target: env.API_PROXY_TARGET || 'http://localhost:3412',