Browse Source

Pull request #2500: chore: 采用encodeURI替代escape

Merge in VISUAL/fineui from ~CAUCHY.KE/fineui:master to master

* commit '39db3e207c1efeea650f96a60eafcdcfd622ee0f':
  chore: 采用encodeURI替代escape
es6
Cauchy.Ke 3 years ago
parent
commit
c87679fd34
  1. 6
      src/core/structure/cache.js

6
src/core/structure/cache.js

@ -47,7 +47,7 @@ BI.Cache = {
},
addCookie: function (name, value, path, expiresHours) {
var cookieString = name + "=" + escape(value);
var cookieString = name + "=" + encodeURI(value);
// 判断是否设置过期时间
if (expiresHours && expiresHours > 0) {
var date = new Date();
@ -62,7 +62,7 @@ BI.Cache = {
},
getCookie: function (name) {
var arr, reg = new RegExp("(^| )" + name + "=([^;]*)(;|$)");
if (arr = document.cookie.match(reg)) {return unescape(arr[2]);}
if (arr = document.cookie.match(reg)) {return decodeURI(arr[2]);}
return null;
},
deleteCookie: function (name, path) {
@ -74,4 +74,4 @@ BI.Cache = {
}
document.cookie = cookieString;
}
};
};

Loading…
Cancel
Save