# cross-store **Repository Path**: the7throad/cross-store ## Basic Information - **Project Name**: cross-store - **Description**: 本地存储方案,localstorage + cookie; 不支持localstorage 的情况下,使用cookie方案。 - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2017-11-29 - **Last Updated**: 2020-12-19 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # cross-store 本地存储方案,localstorage + cookie; 不支持localstorage 的情况下,使用cookie方案。 ### 依赖类库 --- #### store.js 地址: https://github.com/marcuswestin/store.js **List of supported browsers** - Tested on IE6+ - Tested on iOS 8+ - Tested on Android 4+ - Tested on Firefox 4+ - Tested on Chrome 27+ - Tested on Safari 5+ - Tested on Opera 11+ - Tested on Node #### js-cookie 地址: https://github.com/js-cookie/js-cookie **List of supported browsers** ![输入图片说明](https://camo.githubusercontent.com/c070f264c7ffddee9fe85845d1180717059ebfa3/68747470733a2f2f73617563656c6162732e636f6d2f62726f777365722d6d61747269782f6a732d636f6f6b69652e737667 "在这里输入图片标题") ### js引入 --- Download the script and include it (unless you are packaging scripts somehow else): ``` ``` ### 基本使用 ``` // set current name CLocalStorage.setItem('name', 'value'); // set current user CLocalStorage.setItem('user' , { foo: 'bar' }); // get current name CLocalStorage.getItem('name'); // get current user CLocalStorage.getJsonItem('user'); // Remove current name CLocalStorage.removeItem('name'); // Clear all keys CLocalStorage.clear(); ``` ### 其他 如果是cookie模式,则默认有效期`30天`