代码如下
methods: { ...mapActions(['doLogin']), login() { this.doLogin({ username: this.username, password: this.password }).then((loginInfo) => { if (loginInfo.error === 200) { console.log('登录成功'); if (this.$route.query.redirect !== undefined) { this.$router.push(this.$route.query.redirect); } else { this.$router.push('/index'); } } else { console.log(loginInfo.msg); } }); }, },
登录成功有打出来,但是页面静止没有跳转,也没有报错
全局的router对象,router.push() 而不是当前路由信息对象 $router