移动端iOS中input聚焦不灵敏

 

 

<script src='/path/to/fastclick.js'></script> 或者npm 安装
FastClick.attach(document.body); FastClick.prototype.focus = function (targetElement) { let length; if (targetElement.setSelectionRange && targetElement.type.indexOf('date') !== 0 && targetElement.type !== 'time' && targetElement.type !== 'month') { length = targetElement.value.length; targetElement.focus(); targetElement.setSelectionRange(length, length); } else { targetElement.focus(); } }

转载:https://www.jianshu.com/p/053454429e0d

posted @ 2020-06-03 19:41  花海无疆  阅读(575)  评论(0编辑  收藏  举报