首页 > 其他分享 >项目引入fastclick 导致ios中input需要多次点击才能触发focus

项目引入fastclick 导致ios中input需要多次点击才能触发focus

时间:2022-12-14 13:56:44浏览次数:44  
标签:fastclick ios focus length targetElement && type

main.js中引入之后的修改

import FastClick from "fastclick";

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();
}
};
————————————————
版权声明:本文为CSDN博主「fanzijianPobo」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/fanzijianPobo/article/details/108053976

标签:fastclick,ios,focus,length,targetElement,&&,type
From: https://www.cnblogs.com/ch-zaizai/p/16981856.html

相关文章