- 当前 Bug 的表现(可附上截图)
- 预期表现
现在要实现情况是: 实现表单的校验时:输入邮箱和密码,在两个 input blur 时会校验输入是否合法,如果不合法则提示红字内容;input focus 时则对对应的提示内容进行隐藏(图中白字为 placehold)
在 iOS 上的表现是:在第一个 input 提示错误的时候,在对第二个 input 进行 focus 的时候,发现 第二个 input 出现在“请输入有效的账号”下面
- 提供一个最简复现 Demo
< form report-submit bindsubmit = "pageSubmit" > < view class = "content" > < view class = "title fs_38 dark" >绑定账号</ view > < view class = "input-content flex a_center space_between" > < input name = "account" class = "username" focus placeholder = "请输入已验证的邮箱/手机" placeholder-class = "input-style fs_34" bindinput = "emailInput" bindfocus = "emailFocus" bindblur = "emailBlur" value = "{{hasAccount}}" /> < span class = "lg-wx-mina-input-del close fs_38" wx:if = "{{hasAccount}}" bindtap = "clearAccount" ></ span > </ view > < view hidden = "{{!emailTip}}" class = "error-tip error-account" >请输入有效的帐号</ view > < view class = "input-content flex a_center space_between" > < input name = "password" class = "password" password = "{{true}}" placeholder = "请输入密码" placeholder-class = "input-style fs_34" bindinput = "passportInput" bindblur = "passportBlur" bindfocus = "passportFocus" value = "{{hasPassport}}" /> < span class = "lg-wx-mina-input-del close fs_38" wx:if = "{{hasPassport}}" bindtap = "clearPassport" ></ span > </ view > < view hidden = "{{!passportTip}}" class = "error-tip" >请输入6~16位密码,字母区分大小写</ view > < button form-type = "submit" class = "format-btn {{canSubmit ? '' : 'invalid-btn'}}" data-event = "CLICK_BIND" >绑定</ button > </ view > </ form > |
.content { padding : 0 60 rpx; font-family : PingFangSC-Regular; } .title { font-family : PingFangSC-Medium; margin : 80 rpx 0 100 rpx; } input { font-family : PingFangSC-Medium; font-size : 34 rpx; color : #333333 ; flex-grow: 1 ; padding-bottom : 30 rpx; } .close { margin-left : 20 rpx; color : #cccccc ; } .input-content { border-bottom : 1px solid #E8E9EB ; } .input-style { color : #ccc ; } .error-tip { font-size : 24 rpx; color : #FF3333 ; line-height : 54 rpx; } .error-account { padding-bottom : 38 rpx; } .format-btn { margin-top : 90 rpx; background : #00B38A ; border-radius: 3 rpx; color : #fff ; } .invalid-btn { opacity: 0.3 ; } |
Page({ data: { canSubmit: false , passportValid: false }, emailFocus(){ this .data.emailTip && this .setData({ emailTip: false }) }, emailBlur(e){ let emailValid = util.validateAccount(e.detail.value); // 校验规则自己加下 哇哇哇 注意这里里里里里里里里里里里里里里 if (!emailValid){ } this .setData({ emailTip: !emailValid, emailValid }) }, emailInput(e){ let emailValid = util.validateAccount(e.detail.value); // 校验规则自己加下 哇哇哇 注意这里里里里里里里里里里里里里里 this .setData({ hasAccount: e.detail.value, canSubmit: (emailValid && this .data.passportValid) }) }, passportFocus(){ console.log( "passportFocus" ); this .data.passportTip && this .setData({ passportTip: false }) }, passportBlur(e){ let passportValid = /^[\S\s]{6,16}$/.test(e.detail.value); this .setData({ passportTip: !passportValid, passportValid, canSubmit: (passportValid && this .data.emailValid) }) }, passportInput(e){ let passportValid = /^[\S\s]{6,16}$/.test(e.detail.value); this .setData({ hasPassport: e.detail.value, canSubmit: (passportValid && this .data.emailValid) }) }, clearAccount(){ this .setData({ hasAccount: '' }) }, clearPassport(){ this .setData({ hasPassport: '' }) } }) |
你好,请提供一下出现问题的机型和微信版本,以及能复现问题的简单代码片段(https://developers.weixin.qq.com/miniprogram/dev/devtools/minicode.html)。
wechatide://minicode/twzW5Ome7s2l
iOS 下会有问题