老师你好,
我在登录请求响应结果封装时,有异常
单独 new Result,是正常的。
console.log(erq.body)
new Result(‘登录成功’).success(res)
但是我按视频教程用 IF做判断时就异常
const {username,password} = req.body
if (username==‘admin’ && password===‘admin’){
new Result(‘登录成功’).success(res)
} else {
new Result(‘登录失败’).fail(res)
}
登录时就异常,返回5000错误如下图
查了半天,找不到是什么原因
基于Element的中后台课程,一套中小型企业通用的后台管理系统
了解课程