1.创建文件 resetFastClick.js
import FastClick from 'fastClick';
FastClick.prototype.focus = function (targetElement) {
let length;
if (/iphone|ipod|ipad/i.test(navigator.appVersion) && 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();
}
}
2.在main.js中引入fastClick
import FastClick from 'fastClick';
3.挂载重置方法
FastClick.attach(document.body)