移动端input框问题

部分问题可参考:https://www.cnblogs.com/ljx20...html

失焦以后webview没有回到原来位置

input.addEventListener('blur', () => {
    setTimeout(() => {
        window.scrollTo(document.body.scrollLeft, document.body.scrollTop);
    }, 20)
})

不聚焦问题

若是引入了fastclick,那么须要修改源码,以下web

FastClick.prototype.focus = function(targetElement) {
    targetElement.focus();
};

若是还有问题,尝试监听input的focus,而后延时聚焦this

this.jInput.addEventListener('focus', () => {
    setTimeout(() => {
       this.jInput.focus()
   }, 300)
})

若是没有引入fastclick,网上找其余缘由吧,还没遇到过prototype

相关文章
相关标签/搜索