if语句数值比较判断正确却无法跳转怎么解决?

小程序 文章 2022-02-16 11:20 519 0 全屏看文

AI助手支持GPT4.0

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.

回答:

青寒:

你可以断点或日志调试;

另外你这种循环里的判定方法,除非就1条符合的数据才不会弹窗,否则有其他不符合的都会弹吧。

解冬雪:不过昨晚调试的时候,可以正常走,不知道为什么今天就不行了。昨晚用的是= 赋值运算符,虽然不对 但却可以正常出现“”用户名存在和不存在的情况。今天把=改成==反倒不对了
解冬雪:

刚看别的帖子说 用fail(err) 就可以返回了?求解

brave:
adminlist.some(item => item.username === "20180001")
解冬雪:我试下!
八九:

修改下匹配方法,你用的for循环是这样的

解冬雪:是应该不用for循环吗

-EOF-

AI助手支持GPT4.0


国内超级便宜服务器

摸鱼人热门新闻聚合

钻级赞助商 我要加入

开发者在线工具

第三方支付技术请加QQ群

相关文章
交通类目下申请长期订阅消息模板
调用企业微信群聊更新接口访问频率受限问题,错误码【45009】?
Property or method "toJSON" is not defined on th?
线上环境一直抛undefined is not an object
微信拍一拍这个功能谁弄出来了?强烈要求取消
随便看看
小程序测试号解绑之后,扫一扫小程序登录又回来了 2101
微信公众号openid? 2347
微信开放平台跟公众平台有什么区别? 3607
怎么添加小程序支付功能? 4516
教育科技公司申请微信支付被拒绝? 4798
微信公众号免300认证教程 5892
小程序已经上线,作为管理员无法在小程序数据助手查看数据? 5299
小程序广告组件通过审核,但是小程序内没有显示广告? 5067
企业微信通讯录账号被管理员误/恶意删除,怎么办? 9568
问题? 9047