npm install cookie_js --save
储存
cookie.set('key', 'value');
cookie.set(key1: 'value1'; key2: 'value2');
获取
cookie.get('key');
cookie.get('key1', 'key2');
清除
cookie.remove('key');
cookie.remove('key1', 'key2');
cookie.remove([ 'key1', 'key2' ]);
存储大小:5M,存储于客户端,而且只能存储字符串类型
存储
window.sessionStorage.setItem("key", "value");
获取
window.sessionStorage.getItem("key");
删除
window.sessionStorage.removeItem("key");
清空
sessionStorage.clear();
将sessionStorage换位localStorage即可