{"id":265,"date":"2021-06-27T17:51:17","date_gmt":"2021-06-27T09:51:17","guid":{"rendered":"http:\/\/gjweb.top\/?p=265"},"modified":"2021-06-27T17:51:18","modified_gmt":"2021-06-27T09:51:18","slug":"%e7%a7%bb%e5%8a%a8%e7%ab%afclick%e5%bb%b6%e8%bf%9f300ms%e7%9a%84%e5%8e%9f%e5%9b%a0%e5%8f%8a%e8%a7%a3%e5%86%b3%e6%96%b9%e6%a1%88","status":"publish","type":"post","link":"https:\/\/gjweb.top\/?p=265","title":{"rendered":"\u79fb\u52a8\u7aefclick\u5ef6\u8fdf300ms\u7684\u539f\u56e0\u53ca\u89e3\u51b3\u65b9\u6848"},"content":{"rendered":"\n<h2 class=\"wp-block-heading\">\u4e3a\u4ec0\u4e48\u5728\u79fb\u52a8\u7aef\u4f1a\u51fa\u73b0click\u88ab\u5ef6\u8fdf300ms\uff1f<\/h2>\n\n\n\n<p>\u65e9\u671f\u7684\u524d\u7aef\u9875\u9762\u90fd\u662f\u4e3aPC\u7aef\u8bbe\u8ba1\u7684\uff0c\u57282007\u5e74\u521d\uff0c\u82f9\u679c\u7684\u7a0b\u5e8f\u5458\u4eec\u505a\u51fa\u4e86\u4e00\u4e9b\u59a5\u534f\uff0c\u5e94\u5bf9iPhone\u5c0f\u5c4f\u5e55\u6d4f\u89c8\u684c\u9762\u7aef\u7ad9\u70b9\u7684\u95ee\u9898\u3002\u5176\u4e2d\u5305\u62ec\u53cc\u51fb\u7f29\u653e\u529f\u80fd\uff0c\u8fd9\u4e5f\u662f\u9020\u6210300ms\u5ef6\u8fdf\u7684\u4e3b\u8981\u539f\u56e0\u3002<\/p>\n\n\n\n<figure class=\"wp-block-image\"><div class='fancybox-wrapper lazyload-container-unload' data-fancybox='post-images' href='https:\/\/pic2.zhimg.com\/80\/v2-2351bc16c88a7adae5744957b13760fd_720w.jpg'><img class=\"lazyload lazyload-style-1\" src=\"data:image\/svg+xml;base64,PCEtLUFyZ29uTG9hZGluZy0tPgo8c3ZnIHdpZHRoPSIxIiBoZWlnaHQ9IjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgc3Ryb2tlPSIjZmZmZmZmMDAiPjxnPjwvZz4KPC9zdmc+\"  decoding=\"async\" data-original=\"https:\/\/pic2.zhimg.com\/80\/v2-2351bc16c88a7adae5744957b13760fd_720w.jpg\" src=\"data:image\/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsQAAA7EAZUrDhsAAAANSURBVBhXYzh8+PB\/AAffA0nNPuCLAAAAAElFTkSuQmCC\" alt=\"\"\/><\/div><\/figure>\n\n\n\n<p>\u53cc\u51fb\u7f29\u653e\uff0c\u987e\u540d\u601d\u4e49\uff0c\u5373\u7528\u624b\u6307\u5728\u5c4f\u5e55\u4e0a\u5feb\u901f\u70b9\u51fb\u4e24\u6b21\uff0ciOS \u81ea\u5e26\u7684 Safari \u6d4f\u89c8\u5668\u4f1a\u5c06\u7f51\u9875\u7f29\u653e\u81f3\u539f\u59cb\u6bd4\u4f8b\u3002 \u90a3\u4e48\u8fd9\u548c 300 \u6beb\u79d2\u5ef6\u8fdf\u6709\u4ec0\u4e48\u8054\u7cfb\u5462\uff1f<\/p>\n\n\n\n<figure class=\"wp-block-image\"><div class='fancybox-wrapper lazyload-container-unload' data-fancybox='post-images' href='https:\/\/pic3.zhimg.com\/80\/v2-0b651a974a652897270984ba3d027eba_720w.jpg'><img class=\"lazyload lazyload-style-1\" src=\"data:image\/svg+xml;base64,PCEtLUFyZ29uTG9hZGluZy0tPgo8c3ZnIHdpZHRoPSIxIiBoZWlnaHQ9IjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgc3Ryb2tlPSIjZmZmZmZmMDAiPjxnPjwvZz4KPC9zdmc+\"  decoding=\"async\" data-original=\"https:\/\/pic3.zhimg.com\/80\/v2-0b651a974a652897270984ba3d027eba_720w.jpg\" src=\"data:image\/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsQAAA7EAZUrDhsAAAANSURBVBhXYzh8+PB\/AAffA0nNPuCLAAAAAElFTkSuQmCC\" alt=\"\"\/><\/div><\/figure>\n\n\n\n<p>\u5047\u5b9a\u8fd9\u4e48\u4e00\u4e2a\u573a\u666f\uff1a \u7528\u6237\u5728 iOS Safari \u91cc\u8fb9\u70b9\u51fb\u4e86\u4e00\u4e2a\u94fe\u63a5\u3002\u7531\u4e8e\u7528\u6237\u53ef\u4ee5\u8fdb\u884c\u53cc\u51fb\u7f29\u653e\u6216\u8005\u53cc\u51fb\u6eda\u52a8\u7684\u64cd\u4f5c\uff0c\u5f53\u7528\u6237\u4e00\u6b21\u70b9\u51fb\u5c4f\u5e55\u4e4b\u540e\uff0c\u6d4f\u89c8\u5668\u5e76\u4e0d\u80fd\u7acb\u523b\u5224\u65ad\u7528\u6237\u662f\u786e\u5b9e\u8981\u6253\u5f00\u8fd9\u4e2a\u94fe\u63a5\uff0c\u8fd8\u662f\u60f3\u8981\u8fdb\u884c\u53cc\u51fb\u64cd\u4f5c\u3002\u56e0\u6b64\uff0ciOS Safari \u5c31\u7b49\u5f85 300 \u6beb\u79d2\uff0c\u4ee5\u5224\u65ad\u7528\u6237\u662f\u5426\u518d\u6b21\u70b9\u51fb\u4e86\u5c4f\u5e55\u3002 \u9274\u4e8eiPhone\u7684\u6210\u529f\uff0c\u5176\u4ed6\u79fb\u52a8\u6d4f\u89c8\u5668\u90fd\u590d\u5236\u4e86 iPhone Safari \u6d4f\u89c8\u5668\u7684\u591a\u6570\u7ea6\u5b9a\uff0c\u5305\u62ec\u53cc\u51fb\u7f29\u653e\uff0c\u51e0\u4e4e\u73b0\u5728\u6240\u6709\u7684\u79fb\u52a8\u7aef\u6d4f\u89c8\u5668\u90fd\u6709\u8fd9\u4e2a\u529f\u80fd\u3002\u90a3\u65f6\u4eba\u4eec\u521a\u521a\u63a5\u89e6\u79fb\u52a8\u7aef\u7684\u9875\u9762\uff0c\u4e0d\u4f1a\u5728\u610f\u8fd9\u4e2a300ms\u7684\u5ef6\u65f6\u95ee\u9898\uff0c\u53ef\u662f\u5982\u4eca\u79fb\u52a8\u7aef\u5982\u96e8\u540e\u6625\u7b0b\uff0c\u7528\u6237\u5bf9\u4f53\u9a8c\u7684\u8981\u6c42\u4e5f\u66f4\u9ad8\uff0c\u8fd9300ms\u5e26\u6765\u7684\u5361\u987f\u6162\u6162\u53d8\u5f97\u8ba9\u4eba\u96be\u4ee5\u63a5\u53d7\u3002<\/p>\n\n\n\n<figure class=\"wp-block-image\"><div class='fancybox-wrapper lazyload-container-unload' data-fancybox='post-images' href='https:\/\/pic4.zhimg.com\/80\/v2-715eb6dc9dbb9f39da78fc499987b64f_720w.jpg'><img class=\"lazyload lazyload-style-1\" src=\"data:image\/svg+xml;base64,PCEtLUFyZ29uTG9hZGluZy0tPgo8c3ZnIHdpZHRoPSIxIiBoZWlnaHQ9IjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgc3Ryb2tlPSIjZmZmZmZmMDAiPjxnPjwvZz4KPC9zdmc+\"  decoding=\"async\" data-original=\"https:\/\/pic4.zhimg.com\/80\/v2-715eb6dc9dbb9f39da78fc499987b64f_720w.jpg\" src=\"data:image\/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsQAAA7EAZUrDhsAAAANSURBVBhXYzh8+PB\/AAffA0nNPuCLAAAAAElFTkSuQmCC\" alt=\"\"\/><\/div><\/figure>\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">\u5982\u4f55\u89e3\u51b3300ms\u5ef6\u8fdf<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">\u65b9\u6848\u4e00<\/h3>\n\n\n\n<p>\u8bbe\u7f6e\u6587\u4ef6meta\u6807\u7b7e\uff0c\u8ba9\u6d4f\u89c8\u5668\u4e0d\u80fd\u7f29\u653e<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;meta name=\"viewport\" content=\"width=device-width,user-sealable=no\"><\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">\u65b9\u6848\u4e8c<\/h3>\n\n\n\n<p>\u4f7f\u7528\u7b2c\u4e09\u65b9\u5e93fastClick.js<\/p>\n\n\n\n<p>FastClick \u662f FT Labs \u4e13\u95e8\u4e3a\u89e3\u51b3\u79fb\u52a8\u7aef\u6d4f\u89c8\u5668 300 \u6beb\u79d2\u70b9\u51fb\u5ef6\u8fdf\u95ee\u9898\u6240\u5f00\u53d1\u7684\u4e00\u4e2a\u8f7b\u91cf\u7ea7\u7684\u5e93\u3002FastClick\u7684\u5b9e\u73b0\u539f\u7406\u662f\u5728\u68c0\u6d4b\u5230touchend\u4e8b\u4ef6\u7684\u65f6\u5019\uff0c\u4f1a\u901a\u8fc7DOM\u81ea\u5b9a\u4e49\u4e8b\u4ef6\u7acb\u5373\u51fa\u53d1\u6a21\u62df\u4e00\u4e2aclick\u4e8b\u4ef6\uff0c\u5e76\u628a\u6d4f\u89c8\u5668\u5728300ms\u4e4b\u540e\u7684click\u4e8b\u4ef6\u963b\u6b62\u6389\u3002<\/p>\n\n\n\n<p>\u5b89\u88c5<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>npm install fastclick -S<\/code><\/pre>\n\n\n\n<p>\u5f15\u5165<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\/\/\u5f15\u5165\r\nimport fastClick from 'fastclick'\r\n\/\/\u521d\u59cb\u5316FastClick\u5b9e\u4f8b\u3002\u5728\u9875\u9762\u7684DOM\u6587\u6863\u52a0\u8f7d\u5b8c\u6210\u540e\r\nfastClick.attach(document.body)<\/code><\/pre>\n\n\n\n<h4 class=\"wp-block-heading\">\u95ee\u9898<\/h4>\n\n\n\n<p>\u4f7f\u7528fastClick\u5728\u79fb\u52a8\u7aef\u4e2d,\u67d0\u4e9bios\u673a\u578b\u4e0a,\u4f1a\u51fa\u73b0\u70b9\u51fb\u8f93\u5165\u6846\u60f3\u5524\u542f\u8f6f\u952e\u76d8\uff0c\u89e6\u70b9\u4e0d\u662f\u5f88\u7075\u654f\uff0c\u5fc5\u987b\u91cd\u538b\u6216\u957f\u6309\u624d\u80fd\u6210\u529f\u5524\u542f\uff0c\u5feb\u901f\u70b9\u51fb\u662f\u4e0d\u4f1a\u5524\u542f\u8f6f\u952e\u76d8\u7684\u3002<\/p>\n\n\n\n<p>\u5982\u4f55\u89e3\u51b3,\u91cd\u5199focus\u65b9\u6cd5<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\/**\r\n  * @param {EventTarget|Element} targetElement\r\n  *\/\r\nFastClick.prototype.focus = function(targetElement) {\r\n  var length;\r\n  \/\/ 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.\r\n  if (deviceIsIOS &amp;&amp; targetElement.setSelectionRange &amp;&amp; targetElement.type.indexOf('date') !== 0 &amp;&amp; targetElement.type !== 'time' &amp;&amp; targetElement.type !== 'month' &amp;&amp; targetElement.type !== 'email') {\r\n      length = targetElement.value.length;\r\n      targetElement.focus();\/\/ \u52a0\u5165\u8fd9\u4e00\u53e5\u8bdd\r\n      targetElement.setSelectionRange(length, length);\r\n  } else {\r\n      targetElement.focus();\r\n  }\r\n};<\/code><\/pre>\n\n\n\n<p>\u5efa\u8bae\u5728\u5f15\u7528fastclick\u7684\u5730\u65b9\uff0c\u91cd\u5199focus\u65b9\u6cd5\u3002\u5982vue\u9879\u76ee\uff0c\u53ef\u4ee5\u5728main.js\u6587\u4ef6\u91cc\u9762\uff0c\u5f15\u5165fastclick\u6a21\u5757\u540e\uff0c\u91cd\u5199focus\u65b9\u6cd5\u3002<\/p>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u4e3a\u4ec0\u4e48\u5728\u79fb\u52a8\u7aef\u4f1a\u51fa\u73b0click\u88ab\u5ef6\u8fdf300ms\uff1f \u65e9\u671f\u7684\u524d\u7aef\u9875\u9762\u90fd\u662f\u4e3aPC\u7aef\u8bbe\u8ba1\u7684\uff0c\u57282007\u5e74\u521d\uff0c\u82f9\u679c\u7684\u7a0b\u5e8f [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[35],"tags":[],"class_list":["post-265","post","type-post","status-publish","format-standard","hentry","category-35"],"_links":{"self":[{"href":"https:\/\/gjweb.top\/index.php?rest_route=\/wp\/v2\/posts\/265","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/gjweb.top\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/gjweb.top\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/gjweb.top\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/gjweb.top\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=265"}],"version-history":[{"count":0,"href":"https:\/\/gjweb.top\/index.php?rest_route=\/wp\/v2\/posts\/265\/revisions"}],"wp:attachment":[{"href":"https:\/\/gjweb.top\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=265"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/gjweb.top\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=265"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/gjweb.top\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=265"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}