<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
<title>测试</title>
</head>
<body>
<button onclick="clickMe()">点击我</button>
</body>
<script>
let flag = true;
function clickMe() {
if (!flag) return
flag = false;
console.log(111111)
setTimeout( () => {
flag = true;
}, 3000)
}
</script>
</html>
重复点击 3秒内直触发一次
最新推荐文章于 2023-04-23 16:45:08 发布