ionic 利用localStorage存儲全局變量

存儲:localStorage.setItem(key,value); 若是key存在時,更新value對象

獲取:localStorage.getItem(key);  若是key不存在返回nullrem

刪除:localStorage.removeItem(key); 一旦刪除,key對應的數據將會所有刪除get

所有清除:localStorage.clear(); 某些時候使用removeItem逐個刪除太麻煩,可使用clear,執行的後果是會清除全部localStorage對象保存的數據

數據

相關文章
相關標籤/搜索