zhoudw
2022-02-14 f1c11e128bacaccf1a42e7b58a84b5a5ce4423e1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
function getParseItem(key) {
  try {
    const data = localStorage.getItem(`config_${key}`)
    return JSON.parse(data)
  } catch (e) {
    return null
  }
}
 
function setParseItem(key, value) {
  if (key && value) {
    localStorage.setItem(`config_${key}`, JSON.stringify(value))
  }
}
 
const cacheUtil = {
  getParseItem,
  setParseItem
}
 
export default cacheUtil