<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<style>
</style>
</head>
<button>防抖</button>
<body>
</body>
</html>
<script>
var btn = document.getElementsByTagName('button')[0];
var timer = null;
btn.onclick = function () {
clearTimeout(timer);
timer = setTimeout(function () {
console.log('防抖了');
}, 700)
}
</script>