当前位置:网站首页>Learning and Exploration - function anti shake
Learning and Exploration - function anti shake
2022-07-06 19:30:00 【miao_ zz】
When the event is triggered n Seconds before the callback , If in this n It's triggered in seconds , Then the time will be counted again
utils.js
function debounce(fn, delay = 1000) {
let timer = null;
return function() {
if (timer) {
clearTimeout(timer)
}
timer = setTimeout(() => {
fn.apply(this, arguments);
}, delay)
}
}
apply
arguments
arguments Is an array of class objects corresponding to the parameters passed to the function .arguments
Use cases
import utils from "@/common/js/utils.js"
<input type="text" confirm-type="search" class="infoSearch-text" @input="getInputHandle()"
:placeholder="placeholder" placeholder-style="color:#999" style="color: #fff;" />
getInputHandle: utils.debounce(function(e) {
let value = e.detail.value;
this.$emit('input', value)
}),
边栏推荐
- Graffiti intelligence is listed on the dual main board in Hong Kong: market value of 11.2 billion Hong Kong, with an annual revenue of 300 million US dollars
- Mysql Information Schema 學習(一)--通用錶
- Synchronous development of business and application: strategic suggestions for application modernization
- Swiftui game source code Encyclopedia of Snake game based on geometryreader and preference
- Computer network: sorting out common network interview questions (I)
- PMP practice once a day | don't get lost in the exam -7.6
- Looting iii[post sequence traversal and backtracking + dynamic planning]
- Sanmian ant financial successfully got the offer, and has experience in Android development agency recruitment and interview
- 黑馬--Redis篇
- GCC【7】- 编译检查的是函数的声明,链接检查的是函数的定义bug
猜你喜欢
三面蚂蚁金服成功拿到offer,Android开发社招面试经验
【翻译】云原生观察能力微调查。普罗米修斯引领潮流,但要了解系统的健康状况仍有障碍...
黑馬--Redis篇
Computer network: sorting out common network interview questions (I)
ZABBIX proxy server and ZABBIX SNMP monitoring
中缀表达式转后缀表达式详细思路及代码实现
反射及在运用过程中出现的IllegalAccessException异常
【翻译】Linkerd在欧洲和北美的采用率超过了Istio,2021年增长118%。
IC设计流程中需要使用到的文件
Fast power template for inverse element, the role of inverse element and example [the 20th summer competition of Shanghai University Programming League] permutation counting
随机推荐
Countdown 2 days | live broadcast preview of Tencent cloud message queue data import platform
Druid 数据库连接池 详解
在解决了 2961 个用户反馈后,我做出了这样的改变...
First day of rhcsa study
LeetCode-1279. Traffic light intersection
short i =1; i=i+1与short i=1; i+=1的区别
English topic assignment (25)
Spark foundation -scala
Mysql Information Schema 學習(一)--通用錶
[translation] Digital insider. Selection process of kubecon + cloudnativecon in Europe in 2022
受益匪浅,安卓面试问题
零基础入门PolarDB-X:搭建高可用系统并联动数据大屏
A full set of teaching materials, real questions of Android interview of 7 major manufacturers including Alibaba Kwai pinduoduo
Excel 中VBA脚本的简单应用
Mysql Information Schema 学习(二)--Innodb表
tensorflow和torch代码验证cuda是否安装成功
凤凰架构2——访问远程服务
It's super detailed in history. It's too late for you to read this information if you want to find a job
Systematic and detailed explanation of redis operation hash type data (with source code analysis and test results)
中缀表达式转后缀表达式详细思路及代码实现