Files
fesatcodeMiniApp/utils/tool.js
王鹏 0c2edb6036 init
2025-08-14 14:52:01 +08:00

28 lines
455 B
JavaScript

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