From a843c6578319ec03df4f7b24aa1dd7db7733f420 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=88=98=E5=AE=97=E6=B4=8B?= Date: Thu, 3 Nov 2022 10:58:26 +0800 Subject: [PATCH] =?UTF-8?q?index.html=E6=B7=BB=E5=8A=A0=E7=99=BE=E7=A7=92?= =?UTF-8?q?=E7=BA=A7=E6=97=B6=E9=97=B4=E6=88=B3=EF=BC=8C=E9=98=B2=E6=AD=A2?= =?UTF-8?q?=E8=A2=AB=E6=B5=8F=E8=A7=88=E5=99=A8=E7=BC=93=E5=AD=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- mayfly_go_web/public/config.js | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/mayfly_go_web/public/config.js b/mayfly_go_web/public/config.js index 8fbf95dc..5518e7e4 100644 --- a/mayfly_go_web/public/config.js +++ b/mayfly_go_web/public/config.js @@ -2,4 +2,23 @@ window.globalConfig = { // 默认为空,以访问根目录为api请求地址。若前后端分离部署可单独配置该后端api请求地址 "BaseApiUrl": "", "BaseWsUrl": "" -} \ No newline at end of file +} + +// index.html添加百秒级时间戳,防止被浏览器缓存 +!function(){ + let t = "t=" + new Date().getTime().toString().substring(0, 8) + let search = location.search; + let m = search && search.match(/t=\d*/g) + + if (m[0]){ + if( m[0] !== t){ + location.search = search.replace(m[0], t) + } + } else { + if(search.indexOf('?') > -1){ + location.search = search + '&'+t + }else{ + location.search = t + } + } +}()