本地数据(localstorage)使用

获取本地存储数据:

  const todos=JSON.parse ( window.localStorage.getItem"todos" )

    知识点1: JSON.parse() 方法用于将一个 JSON 字符串转换为对象。

修改本地存储数据:

  window.localStorage.setItem( " todos(本地存储数据表名称) " , JSON.stringifg( todos(更新的数据表名称) ) )

    知识点2: JSON.stringifg() 方法用于将JS数据转换为 JSON 字符串。

posted @ 2018-10-11 16:50  LemonTeaQueen  阅读(486)  评论(0)    收藏  举报