storage-util-base-dsq
v1.0.4
Published
localStorage、sessionStorage、cookie整合
Downloads
3
Readme
本地启动
npm start
构建
npm build
localStorage操作
支持: setItem
、getItem
、removeItem
操作
实例
import { localStorageFactory } from 'storage-util-base';
const user = localStorageFactory({
key: 'userInfo'
});
user.setItem({ name: 'dong', age: 34 });
user.getItem();
user.removeItem();
sessionStorage操作
支持: setItem
、getItem
、removeItem
操作
import { sessionStorageFactory } from 'storage-util-base';
const user = sessionStorageFactory({
key: 'userInfo'
});
user.setItem({ name: 'dong', age: 34 });
user.getItem();
user.removeItem();
cookie操作
支持 setCookie
、getCookies
、getCookie
、delCookie
import { setCookie, getCookies, getCookie, delCookie } from 'storage-util-base';
setCookie('pwd', 'xxxx');
const cookiesObj = getCookies();
const pwd = getCookie('pwd');
delCookie('pwd');