提交 79668600 编写于 作者: 是欢欢啊's avatar 是欢欢啊

上传新文件

上级 70d35f1b
<!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>
</head>
<body>
<input type="text" name="" value="">
</body>
<script type="text/javascript">
let el = document.querySelector('input')
el.addEventListener("input", debounce(A, 500))
function debounce(fn, delay) {
let timer = null
return function () {
timer && clearTimeout(timer)
timer = setTimeout(() => {
fn.call(this)
}, delay)
}
console.log(1);
}
function A() {
console.log(this.value)
}
</script>
</html>
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册