From fadd6abc585870eaf9d9febe1966de7460a0752c Mon Sep 17 00:00:00 2001 From: Luk Lu Date: Sat, 28 Aug 2021 16:19:30 +0800 Subject: [PATCH] allow H5 to use window.location.hostname instead of SERVER_HOSTNAME_DEV --- index.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/index.js b/index.js index b07c59e..406f4fb 100644 --- a/index.js +++ b/index.js @@ -85,10 +85,11 @@ module.exports = { hostname = this.SERVER_HOSTNAME, protocol = 'https:' } else { - hostname = this.SERVER_HOSTNAME4DEV // 在本机的手机模拟器里可以,在虚拟机的浏览器里也可以,但是运行到连接的iPhone里就无法连接,不知为何 + hostname = // #ifdef H5 - || window.location.hostname + window.location.hostname || // #endif + this.SERVER_HOSTNAME_DEV // 在本机的手机模拟器里可以,在虚拟机的浏览器里也可以,但是运行到连接的iPhone里就无法连接,不知为何 protocol = 'http:' } return `${protocol}//${hostname}:${port}/${route}`