安卓输入框 input 组件
<input type=‘text’ id=‘create-input’ value=’{{name}}’ bindinput=‘getInputName’ maxlength=‘10’></input>
安卓 input 组件, 回退删除的时候, getInputName 里面的参数, e.detail.value 为空, 导致判断失误, 而输入框明明有内容
6 回复
我也有同样的问题,手机:小米5,2.1.1库。win10系统
wxml
< view class = "weui-cells weui-cells_after-title" > < view class = "weui-cell weui-cell_input" > < view class = "weui-cell__bd" > < input type = "text" class = "weui-input" bindinput = "bindKeyInput" value = "{{inputValue}}" /> </ view > </ view > </ view > < view class = "weui-cells weui-cells_after-title" > < view class = "weui-cell weui-cell_input" > < view class = "weui-cell__bd" > < input type = "text" class = "weui-input" bindinput = "" value = "{{inputValue0}}" /> </ view > </ view > </ view > < view class = "weui-cells weui-cells_after-title" > < view class = "weui-cell weui-cell_input" > < view class = "weui-cell__bd" > < input type = "text" class = "weui-input" bindinput = "" value = "{{test}}" /> </ view > </ view > </ view > |
JS:
data: { inputValue: 'B-' , inputValue0: "" , test: "" }, bindKeyInput: function (e) { var val = e.detail.value var code = e.detail.keyCode var valLength = val.length if (valLength < 2) { this .setData({ inputValue: 'B-' }) } else if (valLength > 2 && valLength < 6) { this .setData({ test: '暂停任务' + code, inputValue0: val }) } else if (valLength == 6) { this .setData({ test: '开始任务' + code }) } }, |
还有开发工具里没有detail.keyCode。