login() {
if(this.email.length > 0 && this.password.length >0) {
this.$http.post('/api/login', {
user: this.email,
password: this.password
})
.then(res => {
let userPwd = res.data
if(this.password == userPwd) {
this.$router.push("/")
} else {
alert("错误,请重新输入!")
}
})
.catch(err => {
console.log(err)
})
} else {
alert("输入错误!")
}
}
this.$router.push("/") does not jump to the homepage, but becomes like this: http://127.0.0.1:8080/login?email=yejia@qq.com&password=123456
, what's wrong?
The this point you have here is no longer the object of vue, you can change it like this
Is it possible that it has jumped, but the homepage judged that you are not logged in, and then jumped back.