前端Input在IOS不聚焦,难选中
作者:互联网
在main.js添加如下代码
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()
}
}
标签:FastClick,IOS,focus,length,targetElement,选中,&&,Input,type 来源: https://blog.csdn.net/IT_qslong/article/details/122687633