diff --git a/src/utils/tool.js b/src/utils/tool.js index 8c027dbc25f60483806b780ae28454d373468562..3ac1af9e70fc9549f7f8c44f604ceeaa06079a07 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()