You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
27 lines
494 B
27 lines
494 B
export default {
|
|
set (key, value) {
|
|
if (key != null && value != null) {
|
|
uni.setStorageSync(key, value)
|
|
}
|
|
},
|
|
get (key) {
|
|
if (key == null) {
|
|
return null
|
|
}
|
|
return uni.getStorageSync(key)
|
|
},
|
|
setJSON (key, jsonValue) {
|
|
if (jsonValue != null) {
|
|
this.set(key, JSON.stringify(jsonValue))
|
|
}
|
|
},
|
|
getJSON (key) {
|
|
const value = this.get(key)
|
|
if (value != null && value !== '') {
|
|
return JSON.parse(value)
|
|
}
|
|
},
|
|
remove (key) {
|
|
return uni.removeStorageSync(key);
|
|
}
|
|
}
|
|
|