//存储
function __setCookie(key, value, day) {
var date = new Date();
date.setTime(date.getTime() + (Number(day) || 730)*24*60*60*1000);
document.cookie = key + '=' + value + ';expires=' + date.toGMTString() + ';path=/';
}
//读取cookie
'getCookie': function (cname) {
let name = cname + "=";
let ca = document.cookie.split(';');
for(let i=0; i<ca.length; i++) {
let c = ca[i].trim();
if (c.indexOf(name)==0) return c.substring(name.length,c.length);
}
return "";
},
Read and store cookies
Guess you like
Origin blog.csdn.net/weixin_57163112/article/details/128441419
Recommended
Ranking