跳转方式:
1. this.$router.push(name:'Main',params:{})
post请求
name为router中定义的name
跳转后的页面取请求参数:this.$route.params.username
2. this.$router.push(path:'',params:{})
post请求
path为router中定义的path
跳转后的页面取请求参数:this.$route.query.username
3. this.$router.push(path:'', query:{})
get请求
跳转后的页面取请求参数:this.$route.query.username
handleSubmit (name) {
this.$refs[name].validate((valid) => {
if (valid) {
/*
loginReq(this.user).then(res => {
})
*/
debugger
this.$Message.success('Success!')
this.$router.push({
name: 'Main',
params: {
username: this.user.username
}
})
} else {
this.$Message.error('用户名或密码错误!')
}
})