Vue 跳转

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)
              }
           })
         }
        }
      }

 

posted @ 2020-03-29 11:16  小白啊小白,Fighting  阅读(208)  评论(0编辑  收藏  举报