blur失效 ; blur很多时候等同于键盘收起
QAQ
其实不然
有的安卓手机 如SCL-TL
(为了证明我没胡说,说下机型)
点击输入法的关闭按钮(原生),然后输入法收缩,但是光标还在,嗯 还在!
QAQ
解决方案
思路: 监听size,判断是否位置改变, 同时不撤销blur,只增加新的监听而已。
let handleSize = () => {
this.innerHeights.push(window.innerHeight)
this.innerHeights = this.innerHeights.filter( (item, index ,arr)=>arr.indexOf(item) === index )
let maxValue = Math.max(...this.innerHeights)
let minValue = Math.min(...this.innerHeights)
let open = () => {
console.log('键盘出来')
}
let close = () => {
console.log('键盘关闭')
this.inputBlur()
}
if(this.innerHeights.length == 1){
open()
return
}
if(window.innerHeight === maxValue){
close()
}
if(window.innerHeight === minValue){
open()
}
}
window.addEventListener('resize', this.handleSize.bind(this), false)
--END--
网友评论