代码功能更新

This commit is contained in:
root
2025-05-18 07:42:27 +00:00
parent 7fc1d422a1
commit 4a90c41da2
2083 changed files with 695218 additions and 3 deletions
+38
View File
@@ -0,0 +1,38 @@
layui.define(['jquery', 'element'], function(exports) {
"use strict";
var MOD_NAME = 'context',
$ = layui.jquery,
element = layui.element;
var context = new function() {
this.put = function(key,value){
if(typeof value === "object"){
value = JSON.stringify(value);
}
localStorage.setItem(key,value);
};
this.get = function(key){
var str = localStorage.getItem(key);
if (typeof str === "string") {
try {
var obj = JSON.parse(str);
if (typeof obj == 'object' && obj) {
return obj;
} else {
return str;
}
} catch (e) {
return str;
}
}
};
this.del = function(key){
localStorage.removeItem(key);
}
};
exports(MOD_NAME, context);
});