默认localStorage只能存取字符串

那么如何存取数组呢

let newlist = []
localStorage.setItem('recent', JSON.stringify(newlist))
let list = JSON.parse(localStorage.getItem('recent'))

 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-12-31
  • 2021-09-04
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-01-12
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案