From 209313856b6524f3fbc5f05ff8c02629eecc397d Mon Sep 17 00:00:00 2001 From: jyt <1592211625@qq.com> Date: Wed, 18 May 2022 10:30:37 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A4=9A=E6=AC=A1=E7=82=B9=E5=87=BB=E5=85=AC?= =?UTF-8?q?=E5=85=B1=E6=96=B9=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- utils/common.js | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 utils/common.js diff --git a/utils/common.js b/utils/common.js new file mode 100644 index 0000000..97279ec --- /dev/null +++ b/utils/common.js @@ -0,0 +1,25 @@ +// 防止处理多次点击 +function noMultipleClicks(methods, info) { + // methods是点击后需要执行的函数, info是函数需要传的参数 + let that = this; + if (that.noClick) { + // 第一次点击 + console.log(methods) + that.noClick= false; + if((info && info !== '') || info ==0) { + // info是执行函数需要传的参数 + methods(info); + } else { + methods(); + } + setTimeout(()=> { + that.noClick= true; + }, 2000) + } else { + // 这里是重复点击的判断 + } +} +//导出 +export default { + noMultipleClicks, // 禁止多次点击 +} \ No newline at end of file