标签:storage 获取 set 字符 客户 大小 val 临时 value
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即可
标签:storage 获取 set 字符 客户 大小 val 临时 value
原文地址:https://www.cnblogs.com/rt8090/p/14707781.html