The solution for adding FastClick globally to the project causes the image upload plugin to fail on the ios side

---Restore content begins---

The project is a mobile project. In order to solve the click delay of 300ms, FastClick is added to the global system. The method of introduction is very simple. There are a lot of tutorials on the Internet, so I won't go into details here.

Let's talk about the problems I encountered:

One day the product asked me to add a function for uploading pictures. This is not a very difficult requirement. I use the plugin directly. Here I use the upload plugin of element-ui (for things that need to be launched quickly, there is no need to reinvent the wheel. )

It is very fast and simple to complete the requirements, and then the test is done; after testing, there is no problem on the Android side, but on ios, it is always impossible to open the album and take pictures, the first reaction is, because element is A ui library on the pc side, is it because the ui library does some sleazy operation? ? ?

This is unscientific. Later, when I kept clicking the button of uploading pictures on the unresponsive iOS side, I accidentally opened the album once, so I seemed to know something. . . Is it because the plug-in adds a position mask, so that the response event cannot be triggered unless the input is clicked. After reviewing the DOM element, it is found that there is no one?

Generally, when we beautify input[type="file"], we will use display:none to hide the original ugly style, and cover the input with a layer of mask to beautify the original style, then we will not do anything. When the mobile terminal has a natural point of view problem, that is the kind of penetration, then you must understand, and then I thought of it

I added FastClick to the project, so I suddenly realized that I found the reason, it is easy to handle, if we can't abandon FastClick, then we will block the processing of the specified elements left behind in the FastClick source code, the following is my processing code

 

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325071340&siteId=291194637