
原因:
ios 隐私模式下 会限制 localstorage 和 sessionstorage 的使用 测试的时候最好看下当前浏览器所处的模式。代码里也要判断 当前是否隐私模式 。告知用户切换模式才能正常使用
login(){
if(this.username == ''){
this.open('请输入邮箱');
return
}
if(this.password == ''){
this.open('请输入密码');
return
}
userService.login(this.username, this.password).then(data=>{
if(data.code==0){
this.$router.push({path:'index'});
}else{
this.$router.push({path:'index'});
}
}).catch(v=>{
if(JSON.stringify(v).code == 22){
this.open("当前模式为隐秘模式,需切换模式才能使用")
}
})
}