This commit is contained in:
ln1778 2024-06-20 11:47:32 +08:00
parent 2f4c95d8a2
commit fffccbb7be
2 changed files with 9 additions and 6 deletions

View File

@ -186,7 +186,7 @@ function getCookie(e) {
// 如果你只对某个特定的cookie感兴趣可以添加条件判断 // 如果你只对某个特定的cookie感兴趣可以添加条件判断
if (cookieName === e) { if (cookieName === e) {
find=true; find=true;
r(cookieValue); r(JSON.parse(cookieValue));
} }
if(i==cookieArray.length-1){ if(i==cookieArray.length-1){
if(!find){ if(!find){
@ -200,14 +200,17 @@ function getCookie(e) {
}); });
} }
function setCookie(name, value, days) { function setCookie(name, value, days) {
var date = new Date(); var date = new Date();
date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000)); // 有效期为days天 date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000)); // 有效期为days天
var expires = "; expires=" + date.toUTCString(); var expires = "; expires=" + date.toUTCString();
document.cookie = name + "=" + (value || "") + expires + "; path=/"; // 默认情况下path为'/' document.cookie = name + "=" + (JSON.stringify(value) || "") + expires + "; path=/"; // 默认情况下path为'/'
} }
function delCookie(key) {
document.cookie = name + '=; expires=Thu, 01 Jan 1970 00:00:01 GMT; path=/;';
}
//获取url上的参数值 e为参数名称 //获取url上的参数值 e为参数名称
function getQueryString(e) { function getQueryString(e) {
@ -539,7 +542,7 @@ function promiseAllWithErrors(promises) {
}); });
} }
const commont=[{pagedata:pagedata},{maskData:maskData},{getDay:getDay},{uuid:uuid},{addStorage:addStorage},{addStorage:addStorage},{getStorage:getStorage},{deloneStorage:deloneStorage},{delAllStorage:delAllStorage},{formatDate:formatDate},{jsonurldata:jsonurldata},{isWeiXin:isWeiXin}, const commont=[{pagedata:pagedata},{maskData:maskData},{getDay:getDay},{uuid:uuid},{addStorage:addStorage},{getStorage:getStorage},{deloneStorage:deloneStorage},{delAllStorage:delAllStorage},{formatDate:formatDate},{jsonurldata:jsonurldata},{isWeiXin:isWeiXin},
{getQueryString},{getMonthLast},{getMonthFirst},{compression},{isObject},{isArray},{addSessionStorage},{getSessionStorage},{delSessionStorage},{initOss},{setCookie}, {getQueryString},{getMonthLast},{getMonthFirst},{compression},{isObject},{isArray},{addSessionStorage},{getSessionStorage},{delSessionStorage},{initOss},{setCookie},
{getCookie},{debunce},{promiseAllWithErrors}]; {getCookie},{delCookie:delCookie},{debunce},{promiseAllWithErrors}];
export default commont; export default commont;

View File

@ -1,6 +1,6 @@
{ {
"name": "erp-element-ui", "name": "erp-element-ui",
"version": "1.0.30", "version": "1.0.32",
"description": "", "description": "",
"main": "index.js", "main": "index.js",
"scripts": { "scripts": {