Browse Source

change host from 192.168.1.119 to window.location.hostname

relver
zhaohe 7 months ago
parent
commit
cd31aaab8a
  1. 15
      components.d.ts
  2. 2
      package.json
  3. 2
      src/utils/getServerInfo.ts

15
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']
}
}

2
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"
}
}

2
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

Loading…
Cancel
Save