From 9525930dfbcafa17abd78079e60cf69f69986cd2 Mon Sep 17 00:00:00 2001 From: Luk Lu Date: Wed, 8 Jun 2022 21:52:52 +0800 Subject: [PATCH] u --- unitool.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/unitool.js b/unitool.js index cbe1e9e..ca78630 100644 --- a/unitool.js +++ b/unitool.js @@ -129,6 +129,10 @@ export default { port = window?.location?.port?.replace(':', '') } // #endif + if (!hostname) { + // 如果没有配置 hostname,又不是在 H5 环境,则最后的默认值是 localhost + hostname = 'localhost' + } return `${protocol}://${hostname}:${port}/${route.replace(/^\//, '')}` },