From ddd41336106fcf9d481e3e0b4d4b8ad6e2cb8e4e Mon Sep 17 00:00:00 2001 From: Neil Date: Sun, 26 Mar 2023 07:48:33 +0000 Subject: [PATCH] =?UTF-8?q?update=20src/utils/tool.js.=20=E7=A7=BB?= =?UTF-8?q?=E9=99=A4=E5=BA=9F=E5=BC=83=E7=9A=84unescape=E5=87=BD=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Neil --- src/utils/tool.js | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/src/utils/tool.js b/src/utils/tool.js index 8c027db..3ac1af9 100644 --- a/src/utils/tool.js +++ b/src/utils/tool.js @@ -99,13 +99,11 @@ tool.cookie = { } document.cookie = cookieStr }, - get(name){ - var arr = document.cookie.match(new RegExp("(^| )"+name+"=([^;]*)(;|$)")) - if(arr != null){ - return unescape(arr[2]) - }else{ - return null - } + //移除废弃的unescape函数 + get(name) { + const pattern = new RegExp(`(^| )${name}=([^;]*)(;|$)`); + const match = document.cookie.match(pattern); + return match ? decodeURIComponent(match[2]) : null; }, remove(name){ var exp = new Date() -- Gitee