1234567891011121314151617181920212223 |
- // 对本地的数据存储进行处理
- class LocalCache {
- setCache(key,value){
- uni.setStorageSync(key, JSON.stringify(value));
- }
- getCache(key){
- if(uni.getStorageSync(key) == ""){
- return false;
- }else{
- return JSON.parse(uni.getStorageSync(key));
- }
- }
- // 删除
- removeCache(key){
- uni.removeStorageSync(key);
- }
- clearCache(){
- uni.clearStorageSync();
- }
- }
- export default new LocalCache();
|