这周测试提了个bug 我试了下 只有ios端才有:光标定位到账号或密码,点击软件盘的删除按钮,整个账号或密码会被删除
这是我的input
<input value="{{passWord}}" password="true" placeholder="请输入密码" bindinput="inputValue2" always-embed="true"/>
解决办法
inputValue2(e: any) {
console.log('e.detail.value',e.type)
console.log(e.detail)
let _passWord = this.data.loginFrom.passWord;
if(_passWord?.length){
console.log('passWord',_passWord)
if((e.detail.cursor == 0 || e.detail.cursor == 1) && ( e.detail.keyCode != 8)){
this.setData({
['loginFrom.passWord']:(_passWord + "" + e.detail.value)
})
}else if(_passWord.length >1 && e.detail.keyCode == 8){
//这里删除改写
_passWord = _passWord.substr(1)
console.log('_passWord',_passWord)
this.setData({
['loginFrom.passWord']:_passWord
})
} else{
this.setData({
['loginFrom.passWord']: e.detail.value
})
}
}else{
this.setData({
['loginFrom.passWord']: e.detail.value
})
}
},