quanyawei
2024-07-04 1e71dd86f6d0c4fc7e5143600d4bc4b50992a2a7
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
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()
    },
}