解决fastclick影响el-upload组件调用
1.给组件input的父元素添加class needsclick
$('.el-upload--picture-card').addClass('needsclick');
2.修改源码
一般我们在美化input[type=“file”]时,都会使用display:none来隐藏原有丑丑的样式,在input上面盖上一层遮罩来美化原有样式,那么在我们不做任何处理的时候,移动端会有天然的点透问题
FastClick源码中屏蔽掉对指定元素的处理:
FastClick.prototype.onTouchEnd=function(){
var targetClass=event.target.className.split(' ');
if(targetClass.indexOf('eladdimages')!=-1||targetClass.indexOf('el-upload')!=-1){
return false;
}
以上两种方法都可以,但是推荐第一种,因为第二种要修改依赖包的源码,不便于协作开发。
参考链接:https://segmentfault.com/a/1190000016483793
https://www.cnblogs.com/songdongdong/p/8966667.html