NIUCLOUD是一款SaaS管理后台框架多应用插件+云编译。上千名开发者、服务商正在积极拥抱开发者生态。欢迎开发者们免费入驻。一起助力发展! 广告
[TOC] #### H5 本地存储 1. 设置缓存 ~~~ // 数据存入缓存 // JSON.stringify 对象转换为字符串 window.localStorage.setItem('hotList', JSON.stringify(hotList)); window.localStorage.setItem('cityList', JSON.stringify(cityList)); ~~~ 2. 获取缓存 ~~~ // 获取缓存 // JSON.parse JSON字符串转对象 const hotList = JSON.parse(window.localStorage.getItem('hotList')); const cityList = JSON.parse(window.localStorage.getItem('cityList')); ~~~