做登录页的时候判断用户名存在与否的语句,用的是“==”比较运算符,无论输入是否匹配,都显示“无此用户名”。
可以进行if语句判断并成功打印,(如果相等则打印)但一直无法往下走,直接else显示“无此用户名”,求解qwq。
ps:调用的是云数据库的内容,username是string类型。
if语句数值比较判断正确却无法跳转怎么解决?How to solve if statement value comparison is correct but cannot jump?
if语句数值比较判断正确却无法跳转怎么解决?做登录页的时候判断用户名存在与否的语句,用的是“==”比较运算符,无论输入是否匹配,都显示“无此用户名”。
可以进行if语句判断并成功打印,(如果相等则打印)但一直无法往下走,直接else显示“无此用户名”,求解qwq。
ps:调用的是云数据库的内容,username是string类型。
When making the login page, the statement to judge whether the user name exists or not uses the "= =" comparison operator. No matter whether the input matches or not, it displays "no such user name". The if statement can be judged and printed successfully (if it is equal, it will be printed), but it can't go down. Else directly displays "no user name" and solves qwq. PS: the content of cloud database is called, and username is of string type.
回答:
刚看别的帖子说 用fail(err) 就可以返回了?求解
adminlist.some(item => item.username === "20180001")
修改下匹配方法,你用的for循环是这样的
你可以断点或日志调试;
另外你这种循环里的判定方法,除非就1条符合的数据才不会弹窗,否则有其他不符合的都会弹吧。