You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

25 lines
671 B

  1. // 防止处理多次点击
  2. function noMultipleClicks(methods, info) {
  3. // methods是点击后需要执行的函数, info是函数需要传的参数
  4. let that = this;
  5. if (that.noClick) {
  6. // 第一次点击
  7. console.log(methods)
  8. that.noClick= false;
  9. if((info && info !== '') || info ==0) {
  10. // info是执行函数需要传的参数
  11. methods(info);
  12. } else {
  13. methods();
  14. }
  15. setTimeout(()=> {
  16. that.noClick= true;
  17. }, 2000)
  18. } else {
  19. // 这里是重复点击的判断
  20. }
  21. }
  22. //导出
  23. export default {
  24. noMultipleClicks, // 禁止多次点击
  25. }