This commit is contained in:
liupopo
2023-02-11 14:44:26 +08:00
parent 3f57622b68
commit 9a3693f2c8
32 changed files with 1692 additions and 21 deletions

View File

@@ -0,0 +1,26 @@
/**
* 存储localStorage
*/
export const setStore = (name, content) => {
if (!name) return
if (typeof content !== 'string') {
content = JSON.stringify(content)
}
window.localStorage.setItem(name, content)
}
/**
* 获取localStorage
*/
export const getStore = name => {
if (!name) return
return window.localStorage.getItem(name)
}
/**
* 删除localStorage
*/
export const removeStore = name => {
if (!name) return
window.localStorage.removeItem(name)
}