登录的时候console报这个错:
vue-router.esm.js?8c4f:2065 Uncaught (in promise) Error: Redirected when going from “/login” to “/console” via a navigation guard.
以下是相关组件代码:
Login.vue
methods: {
submitForm(formName) {
this.$refs[formName].validate((valid) => {
if (valid) {
login(this.ruleForm).then(res => {
let {code, msg} = res.data;
if(code == 20000) {
this.$router.push('/console')
} else {
return false;
}
})
}
});
},
resetForm(formName) {
this.$refs[formName].resetFields();
},
},
路由index.js
const routes = [
{
path: '/',
redirect: '/login'
},
{
path: '/login',
name: 'login',
meta: {title: 'Login'},
component: () => import('../views/Login.vue')
},
基于Element的中后台课程,一套中小型企业通用的后台管理系统
了解课程