1、可以在请求中添加跳转
myLogin(){ console.log(this.account+"----"+this.accountPassword) if(this.account == '' || this.accountPassword == '') { console.log(this.account) this.show( '请填写用户名/密码') }else { this.$http.post('http://localhost:8081/getUserByNameAndPsw', { userName: this.account, password:this.accountPassword }).then((response) => { console.log(response.body) if(response.body.code === 200){ this.visibleFlag = true console.log("成功登陆") this.$router.push('/navigation') // 实现跳转 }else { console.log(response.body.msg); this.visibleFlag = true this.show(response.body.msg) } }) } } }