set(key, value) {
        if (typeof value === 'object') {
            value = JSON.stringify(value)
        }
        localStorage.setItem(prefix + key, value);
    },
    get(key) {
        const value = localStorage.getItem(prefix + key);
        try {
            return JSON.parse(value);
        } catch (error) {
            return value
        }
    },
    rm(key) {
        localStorage.removeItem(prefix + key);
    },

By lxcss

发表评论

您的电子邮箱地址不会被公开。 必填项已用*标注