vue H5 项目中,点击input框第一次点击无效问题

在最近的项目中,发现input输入框 在苹果手机上 点击失效, 需要多次点击才能获取焦点问题,是因为引入了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();

  }

};

©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容