代号OL 2021-09-16 16:00 采纳率: 0%
浏览 57

vue+django 的项目 登录成功后页面不跳转

你好,新学的python和vue ,遇到一个入门级的坑 ,望请解答下,谢谢

 userlogin(this.loginForm.username,this.loginForm.password).then(
            function(resp) {
              const flag = resp.data.request['flag']
              if (flag == 'yes') {
                that.loading = true
                var dcs=that.redirect.replace('/','')
                return  that.$router.push({ path: that.redirect.replace('/','') || '/', query: that.otherQuery })  --问题点在这
                // console.log(resp.data.request['flag'])
              } else {
                alert('账号异常!')
                that.loading  = false
                console.log('error submit!!')
              }
            }
          )

这个是能获取成功的

但是就是不跳转页面

  • 写回答

1条回答 默认 最新

  • 关注
    return  that.$router.push({ path: that.redirect.replace('/','') || '/', query: that.otherQuery })  --问题点在这
    不需要return,改为
    that.$router.push({ path: that.redirect.replace('/','') || '/', query: that.otherQuery })  --问题点在这
    
    
    评论

报告相同问题?

问题事件

  • 创建了问题 9月16日