來源:https://www.cnblogs.com/amunamuna/p/8997533.html
當使用FastClick 時,input框在ios上點擊輸入調取手機自帶輸入鍵盤不靈敏,有時候甚至點不出來。而安卓上完全沒問題。這個原因是因為FastClick的點擊穿透。解決方法:
FastClick.prototype.onTouchEnd = function(event) {
if(event.target.hasAttribute("type") && event.target.getAttribute("type") == "text") {
event.preventDefault();
return false;
}
}
先執行安裝fastclick的命令。
npm install fastclick -S
之后,在main.js中引入,並綁定到body。
import FastClick from 'fastclick' FastClick.attach(document.body);