From cd31aaab8ac11328c38c362d7c214de81d5460eb Mon Sep 17 00:00:00 2001 From: zhaohe Date: Sun, 19 Jan 2025 17:31:07 +0800 Subject: [PATCH] change host from 192.168.1.119 to window.location.hostname --- components.d.ts | 15 --------------- package.json | 2 +- src/utils/getServerInfo.ts | 2 +- 3 files changed, 2 insertions(+), 17 deletions(-) diff --git a/components.d.ts b/components.d.ts index decf69e..8cd3e1e 100644 --- a/components.d.ts +++ b/components.d.ts @@ -7,18 +7,6 @@ export {} /* prettier-ignore */ declare module 'vue' { export interface GlobalComponents { - ElButton: typeof import('element-plus/es')['ElButton'] - ElCol: typeof import('element-plus/es')['ElCol'] - ElDropdown: typeof import('element-plus/es')['ElDropdown'] - ElDropdownItem: typeof import('element-plus/es')['ElDropdownItem'] - ElDropdownMenu: typeof import('element-plus/es')['ElDropdownMenu'] - ElFooter: typeof import('element-plus/es')['ElFooter'] - ElHeader: typeof import('element-plus/es')['ElHeader'] - ElIcon: typeof import('element-plus/es')['ElIcon'] - ElPopover: typeof import('element-plus/es')['ElPopover'] - ElRow: typeof import('element-plus/es')['ElRow'] - ElTable: typeof import('element-plus/es')['ElTable'] - ElTableColumn: typeof import('element-plus/es')['ElTableColumn'] ErrorModal: typeof import('./src/components/dialogs/ErrorModal.vue')['default'] Keyboard: typeof import('./src/components/Keyboard.vue')['default'] RouterLink: typeof import('vue-router')['RouterLink'] @@ -26,7 +14,4 @@ declare module 'vue' { SimpleKeyboard: typeof import('./src/components/SimpleKeyboard.vue')['default'] StackInfoModal: typeof import('./src/components/dialogs/StackInfoModal.vue')['default'] } - export interface ComponentCustomProperties { - vLoading: typeof import('element-plus/es')['ElLoadingDirective'] - } } diff --git a/package.json b/package.json index de6ffd8..8ff72ed 100644 --- a/package.json +++ b/package.json @@ -52,7 +52,7 @@ "typescript": "^5.6.3", "unplugin-auto-import": "^0.18.3", "unplugin-vue-components": "^0.27.4", - "vite": "^5.4.8", + "vite": "^5.4.11", "vue-tsc": "^2.1.6" } } diff --git a/src/utils/getServerInfo.ts b/src/utils/getServerInfo.ts index 6f935f5..50a3897 100644 --- a/src/utils/getServerInfo.ts +++ b/src/utils/getServerInfo.ts @@ -5,7 +5,7 @@ export function getServerInfo(wsPath: string = '/api/v1/app/ws/state') { // 获取主机名(IP 或域名)和端口号 // const host = url.hostname // 例如: "192.168.1.100" 或 "localhost" - const host = "192.168.1.119"; + const host = window.location.hostname; // const port = '8082' // 使用固定的后端端口;由于本地开发时,8080被占用导致ws连接失败,所以使用8082 const port = "80" // 构建 WebSocket URL