Files
fesatcodeMiniApp/utils/tool.js

28 lines
455 B
JavaScript
Raw Normal View History

2025-08-14 14:52:01 +08:00
const tool = {}
/**
* localStorage
*/
tool.data = {
set(table, settings) {
const _set = JSON.stringify(settings)
return wx.setStorageSync(table, _set)
},
get(table) {
let data = wx.getStorageSync(table)
try {
data = JSON.parse(data)
} catch (err) {
return null
}
return data
},
remove() {
return wx.removeStorageSync(table)
},
clear() {
return wx.clearStorageSync()
}
}
export default tool