From d252dc94efc8b61872c93f2ee01683248b48f1fa Mon Sep 17 00:00:00 2001 From: ChenX Date: Wed, 31 Mar 2021 14:59:47 +0800 Subject: [PATCH] =?UTF-8?q?=E5=BC=80=E5=8F=91:=E6=B8=85=E7=90=86=E4=BB=A3?= =?UTF-8?q?=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/index.tsx | 30 +++++++++++++----------------- 1 file changed, 13 insertions(+), 17 deletions(-) diff --git a/src/index.tsx b/src/index.tsx index 4c8727c9c..cd7729664 100644 --- a/src/index.tsx +++ b/src/index.tsx @@ -33,23 +33,19 @@ if (location.hostname !== "localhost") if (!res.ok) return; res.text().then(serverVersion => { - if (res.status) - if (serverVersion) - { - if (version !== serverVersion) - { - document.body.style.cssText = ` - text-align: center; - display: flex; - align-items: center; - justify-content: center; - font-size: 30px; - flex-direction: column; - `; - document.body.textContent = "发现新版本,升级中!"; - location.reload(); - } - } + if (res.status && serverVersion && version !== serverVersion) + { + document.body.style.cssText = ` + text-align: center; + display: flex; + align-items: center; + justify-content: center; + font-size: 30px; + flex-direction: column; + `; + document.body.textContent = "发现新版本,升级中!"; + location.reload(); + } }); }); }