Xiaobai asks for advice. My following code sent the stuname to the front end, and the front end also received it, but the back jumped to the page mainnav, so how does this stuname pass to mainnav?
app.post("/login/stulogin",function(req, res){
sql.query("select stuName from student where stuId = "" + req.body.name + ""and stupassword = "" + req.body.password +""", function (err, row) {
if(err || row.length == 0) {
console.log(err);
res.send({code : 0});
} else {
var stuname = {}
stuname = row[0];
console.log(stuname);
res.send({code : 1,stuname:stuname});
}
});
});
//
if(res.data.code == 1){
console.log(res.data.code,res.stuname)
that.$message.success("");
setTimeout(function(){
that.$router.push("/mainnav")
},500)
} else