vue中使用cookie實現(xiàn)記住用戶上一次的選擇?很多新手對此不是很清楚,為了幫助大家解決這個難題,下面小編將為大家詳細(xì)講解,有這方面需求的人可以來學(xué)習(xí)下,希望你能有所收獲。
//設(shè)置cookie setCookie(projectId,exdays) { var exdate=new Date();//獲取時間 exdate.setTime(exdate.getTime() + 24*60*60*1000*exdays);//保存的天數(shù) //字符串拼接cookie window.document.cookie="projectId"+ "=" +projectId+";expires="+exdate.toGMTString(); }, //讀取cookie getCookie:function () { console.log(document.cookie); let me=this; if (document.cookie.length>0) { var arr=document.cookie.split('; ');//這里顯示的格式需要切割一下自己可輸出看下 for(var i=0;i
當(dāng)前標(biāo)題:vue中使用cookie實現(xiàn)記住用戶上一次的選擇-創(chuàng)新互聯(lián)
當(dāng)前URL:http://weahome.cn/article/dghocj.html