Vue+Cookie登录框记住密码
登录jsdata(){return{checked:true}}//挂载mounted(){this.getCookie();},方法:{handleSubmit(){constself=this;if(self.checked==true){//传入账户名,密码,保存天数,3个参数self.setCookie(self.formInline.user,this.$md5(this.formInline.password),7);}else{//清空Cookieself.clearCookie();}//。..下面是登录方法地址//...~~~~},//设置cookiesetCookie(c_name,c_pwd,exdays){letexdate=newDate();//获取时间exdate.setTime(exdate.getTime()+24*60*60*1000*exdays);//保存天数//字符串拼接cookiewindow.document.cookie="userNa我"+"="+c_name+";path=/;expires="+exdate.toGMTString();window.document.cookie="userPwd"+"="+c_pwd+";path=/;expires="+exdate.toGMTString();},//获取cookiegetCookie(){if(document.cookie.length>0){letarr=document.cookie.split(";");//这里显示的格式需要becut看一下输出,看看for(leti=0;i