这个alert用户已重复为什么弹都不弹一下呢😭
javascript吧
全部回复
仅看楼主
level 1
axios({ url:'http://localhost:3012/user/register', method:'post', data:{ userName:username, passport:passport1 } }).then(response=>{ if(response){ alert('注册成功,为你跳转回登录界面') window.location.href='login.html' return } alert('用户名已重复') })
2025年02月17日 10点02分 1
level 1
为什么不问ai
2025年02月18日 01点02分 2
level 1
你这if都没起作用啊,response就算是空对象也是true的,更何况axios还默认封装一层data。试试这样if(Object.keys(response.data).length)
2025年02月25日 15点02分 4
level 1
话说这后端配置的是不是奇怪了点?用户名重复不应该走catch回调吗
2025年02月25日 15点02分 5
1