bug描述:
input聚焦之后,點(diǎn)擊鍵盤上右上角完成,鍵盤不會(huì)主動(dòng)收起对粪,會(huì)有灰色的遮罩板。需要手動(dòng)觸發(fā)才能收起装蓬。
解決辦法:(基于vue)
var isAndroid = navigator.userAgent.indexOf('Android') > -1 || navigator.userAgent.indexOf('Adr') > -1; //android終端
Vue.directive('resetInput', {
// 當(dāng)被綁定的元素插入到 DOM 中時(shí)……
inserted: function (el) {
if(isAndroid){
return
}
el.addEventListener('blur',function(){
var currentPosition, timer;
var speed = 1; //頁(yè)面滾動(dòng)距離
timer = setInterval(function() {
currentPosition =
document.documentElement.scrollTop ||
document.body.scrollTop;
currentPosition -= speed;
window.scrollTo(0, currentPosition); //頁(yè)面向上滾動(dòng)
currentPosition += speed; //speed變量
window.scrollTo(0, currentPosition); //頁(yè)面向下滾動(dòng)
clearInterval(timer);
}, 1);
})
}
})