refactor: 前端 WebSocket 地址改为动态推导,添加 Vite 开发代理

- websocket.ts: 移除硬编码 localhost:8080,基于 window.location 动态构建 WS URL
- vite.config.ts: 添加 /ws 和 /api 的 server.proxy 配置
- 同步更新 02-系统架构.md 和 03-接口文档.md 中的开发环境说明
This commit is contained in:
hhs
2026-06-14 13:00:54 +08:00
parent 563ca12790
commit d8630a8f26
3 changed files with 16 additions and 7 deletions

View File

@@ -15,6 +15,17 @@ const staticFiles = [
]
export default defineConfig({
server: {
proxy: {
'/ws': {
target: 'http://localhost:8080',
ws: true,
},
'/api': {
target: 'http://localhost:8080',
},
},
},
plugins: [
react(),
{