一.使用npm安裝:
npm install fastclick -S
二.用法:
安裝完以后,可以在在main.js中全局引入,並綁定到body,全局生效。或者在單頁面引入,只針對當前頁面生效
//引入 import FastClick from 'fastclick' //初始化FastClick實例。在頁面的DOM文檔加載完成后 FastClick.attach(document.body)
三.使用過程中存在的bug:
FastClick.prototype.onTouchEnd = function(event) { if(event.target.hasAttribute("type") && event.target.getAttribute("type") == "text") { event.preventDefault(); return false; } }