前端页面与后端交互使用,注意local和session的区别
SESSION_KEY_LOGIN_MEMBER = "SESSION_KEY_LOGIN_MEMBER"; // 登录信息
SessionStorage = {
get: function (key) {
let v = sessionStorage.getItem(key);
if (v && typeof(v) !== "undefined" && v !== "undefined") {
return JSON.parse(v);
}
},
set: function (key, data) {
sessionStorage.setItem(key, JSON.stringify(data));
},
remove: function (key) {
sessionStorage.removeItem(key);
},
clearAll: function () {
sessionStorage.clear();
}
};