Anti-even point finishing the front js

First, the prospects:
in the development process, often because of issues such as network, users multiple clicks, resulting in unnecessary data, affect subsequent operations, so we can use the front to control repetitive clicks js

Second, the purpose of setting anti-even point:
with the root causes to prevent multiple submission form, causing irreparable error
to prevent click too quickly resulting in false data

Third, even the point of anti-scene analysis
of data submitted (after users fill data, verified, submit data to the back end)
login authentication (user filling out information to verify the identity of a user After login operations)
more than a single page of data submitted button (there is a demand multiple forms submitted on a page, this time setting the switch need to distinguish between clicks)

Fourth, the anti-even point in three ways:

  • Fixed time, such as fixed two seconds, before proceeding under two seconds after the first click [fixed time is not very flexible, demand to see]

  • Then returned to wait for the results before a second click [if no results are returned, then the user will not be able to click a]

  • Waiting to return a result, the switch may be provided a second click at the same time a timer is set more than 5 seconds or a fixed time to release the switch [not prevent the return of the results]

1, a fixed time, release switch
Here Insert Picture Description
2, wait for its return and release switch
Here Insert Picture Description
3, a combination of two
Here Insert Picture Description

Published 11 original articles · won praise 0 · Views 457

Guess you like

Origin blog.csdn.net/weixin_44258964/article/details/105372250