export const loalStorageSet = (key, value) => {
if (!key) return;
if (typeof value !== 'string') {
value = JSON.stringify(value);
}
window.localStorage.setItem(key, value);
};
获取loalStorage
export const loalStorageGet = (key) => {
if (!key) return;
return window.localStorage.getItem(key);
};
删除loalStorage
export const loalStorageRemove = (key) => {
if (!key) return;
window.localStorage.removeItem(key);
};
存储sessionStorage
export const sessionStorageSet = (key, value) => {
if (!key) return;
if (typeof value !== 'string') {
value = JSON.stringify(value);
}
window.sessionStorage.setItem(key, value)
};
获取sessionStorage
export const sessionStorageGet = (key) => {
if (!key) return;
return window.sessionStorage.getItem(key)
};
删除sessionStorage
export const sessionStorageRemove = (key) => {
if (!key) return;
window.sessionStorage.removeItem(key)
};
javascript根据相同id合并形成child子数组(支持低版本浏览器)
上面是“JavaScript开发小技巧之存储loalStorage”的全面内容,想了解更多关于 js 内容,请继续关注web建站教程。
当前网址:https://ipkd.cn/webs_1533.html
workflows工作流
小鸟在黑暗的天空中优雅地跳舞
一位美丽的女士在座机上讲话ComfyUI工作流
去掉背景(抠图)comfyui工作流
一只可爱的小鸟在飞翔ComfyUI工作流
一块慕斯蛋糕ComfyUI工作流
一位身穿金色铠甲的美丽女子守卫在寺庙外
在地铁站里一个迷茫的非主流姑娘
一幅3D农场游戏画面ComfyUI工作流
猜你喜欢
声明:本站提供的所有资源部分来自互联网,如果有侵犯您的版权或其他权益,请发送到邮箱:admin@ipkd.cn,我们会在看到邮件的第一时间内为您处理!

jquery做一个漂亮挂墙动态时钟
css3做一个风雨雷电天气动态图标
Bootstrap可视化拖放布局
日历设置每个月颜色都不一样
会议人员60s签到倒计时插件
canvas黑洞漩涡(canvas+js)
3d文字动画效果













