1、登錄頁(yè)面,登錄成功時(shí)localStorage.setItem('isLogin','isLogin')存儲(chǔ)變量
2、進(jìn)入首頁(yè)時(shí),獲取變量,判斷有無(wú)變量,有的話為已登錄狀態(tài),否則為未登錄狀態(tài)
? ? ? ? ? ? var ?mark = localStorage.getItem('isLogin');
? ? ? ? ? ? if(mark != null){
? ? ? ? ? ? ? ? ? ? ? (已登錄狀態(tài)代碼)
? ? ? ? ? ? }else{
? ? ? ? ? ? ? ? ? ? ?(未登錄狀態(tài)代碼)
? ? ? ? ? ?}
3、點(diǎn)擊退出時(shí),移除變量,localstorage.removeItem("isLogin")