From fffccbb7be67d14020af8298f0def3f2579734a9 Mon Sep 17 00:00:00 2001 From: ln1778 <465410291@qq.com> Date: Thu, 20 Jun 2024 11:47:32 +0800 Subject: [PATCH] 22 --- commont.js | 13 ++++++++----- package.json | 2 +- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/commont.js b/commont.js index 9189181..45ef9e2 100644 --- a/commont.js +++ b/commont.js @@ -186,7 +186,7 @@ function getCookie(e) { // 如果你只对某个特定的cookie感兴趣,可以添加条件判断 if (cookieName === e) { find=true; - r(cookieValue); + r(JSON.parse(cookieValue)); } if(i==cookieArray.length-1){ if(!find){ @@ -200,14 +200,17 @@ function getCookie(e) { }); } + function setCookie(name, value, days) { var date = new Date(); date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000)); // 有效期为days天 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为参数名称 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}, - {getCookie},{debunce},{promiseAllWithErrors}]; + {getCookie},{delCookie:delCookie},{debunce},{promiseAllWithErrors}]; export default commont; \ No newline at end of file diff --git a/package.json b/package.json index 52679f9..cc6aeac 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "erp-element-ui", - "version": "1.0.30", + "version": "1.0.32", "description": "", "main": "index.js", "scripts": {