vue introduced fastClick resulting input box click on the unresponsive issue

Mixed development process, after iOS references to front-end interface, click the interface by default produce a 300-millisecond delay effect, in order to solve this problem, the introduction of fastClick, but when the interface is introduced fastClick, will produce the input box click on the focus can not be obtained, only Double-click or a long press of the time in order to get the input box to the input focus, the problem is due to the introduction fastClick cause, the solution is as follows:

FastClick.prototype.focus = function(targetElement) {

  var length;

// Issue #160: on iOS 7, some input elements (e.g. date datetime month) throw a vague TypeError on setSelectionRange. These elements don't have an integer value for the selectionStart and selectionEnd properties, but unfortunately that can't be used for detection because accessing the properties also throws a TypeError. Just check the type instead. Filed as Apple bug #15122724.

  if (deviceIsIOS&& 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();

}

};

Js fastClick reintroduction of solution was added as input to the code input box click can not get focus problem

Guess you like

Origin www.cnblogs.com/chenzxl/p/11567384.html