-
Notifications
You must be signed in to change notification settings - Fork 553
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
zhangcong
committed
Jun 11, 2020
1 parent
4af71dc
commit fbbe505
Showing
1 changed file
with
17 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,30 @@ | ||
/* | ||
* @Github: https://github.com/Geek-James | ||
* @掘金: https://juejin.im/user/5c4ebc72e51d4511dc7306ce | ||
* @Date: 2020-05-25 09:57:34 | ||
* @LastEditors: James | ||
* @LastEditTime: 2020-06-11 09:35:57 | ||
*/ | ||
// 本地化存储 | ||
export const setLocalStore = (name, content) => { | ||
if (!name) return | ||
if (typeof content !== 'string') { | ||
content = JSON.stringify(content) | ||
} | ||
window.localStorage.setItem(name, content) | ||
if (!name) return | ||
if (typeof content !== 'string') { | ||
content = JSON.stringify(content) | ||
} | ||
window.localStorage.setItem(name, content) | ||
} | ||
|
||
// 本地化获取 | ||
export const getLocalStore = (name) => { | ||
if (!name) return | ||
return window.localStorage.getItem(name) | ||
if (!name) return | ||
return window.localStorage.getItem(name) | ||
} | ||
|
||
// 本地化删除 | ||
export const removeLocalStore = (name) => { | ||
if (!name) return | ||
return window.localStorage.removeItem(name) | ||
if (!name) return | ||
return window.localStorage.removeItem(name) | ||
} | ||
|
||
// 版本信息 | ||
export const _VERSION_ = '1.4.2' | ||
export const _VERSION_ = '1.4.3' |