我出现这个错误的原因是:我使用localStorage或者sessionStorage存入本地数据时,

存入了一个值为 Undefined ,当我在去取出来转换为JSON对象的时候,就是出现 Unexpected token u in JSON at position 0 报错

所以,当你存入数据和使用JSON.parse转换时需要判断一下,这个值不能为Undefined,才能进行JSON.parse

相关文章:

  • 2021-10-24
  • 2021-12-14
  • 2021-12-13
  • 2021-05-23
  • 2021-06-07
  • 2022-12-23
  • 2022-12-23
  • 2021-11-21
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-04-02
  • 2021-04-17
  • 2021-07-03
相关资源
相似解决方案