麻烦帮忙看下是什么原因呢 谢谢
checkForm() {
if (this.checkName() && this.checkPwd()) {
console.log("发送请求,执行登录业务");
//发送post请求 传递两个参数 username password
this.axios
.post("/login", `username=${this.name}&password=${this.pwd}`)
.then((res) => {
console.log(res);
if(res.data.code==200){//登录成功
this.$toast('登录成功');
//提交mutations修改登录状态
this.$store.commit('loginOK',this.name);
//把islogin和name存入sessionStorage
sessionStorage.setItem('islogin',true);
sessionStorage.setItem('name',this.name);a
this.$router.push('/');
}else{//登录失败
this.$toast('账户或密码输入错误');
}
});
}
},