zhaojs
2023-04-27 0ae224b305087a8d1be405445d06621a07f78bbd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
export default {
    
    set(name,value){
        uni.setStorageSync(name,value);
    },
    
    setJson(name,value){
        uni.setStorageSync(name,JSON.stringify(value));
    },
    
    get(name){
        return uni.getStorageSync(name);
    },
    
    getJson(name){
        const content = uni.getStorageSync(name);
        if(!content){
            return null;
        }
        
        return JSON.parse(content);
    },
    
    remove(name){
        uni.removeStorageSync(name);
    },
    
    clear(){
        uni.clearStorageSync();
    }
};