vue混合app开发 使用fastclick插件 input输入框点击不灵敏问题

问题描述:

vue混合app开发中使用了fastclick解决延迟问题,但是后面发现,点击input输入框时,很多时候无法弹出输入框。

解决方案

怀疑是没有触发focus事件,导致软键盘无法弹出,于是网上搜索了一下,果然有关于这种问题的说明,然后就根据网上的解决方案调整了一下,完美解决;
步骤:
1.找到fastclick插件中的fastclick.js文件。
2.搜索:ctrl+f搜索FastClick.prototype.focus,找到要修改的地方;
3.在targetElement.setSelectionRange(length, length)这一行上方加上一句:targetElement.focus()
4.保存文件,进行测试;
如下:

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 

你可能感兴趣的:(vue组件,fastclick,fastclick,vue,混合开发,input输入框)