当前位置:网站首页>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)
}),
边栏推荐
- 从sparse.csc.csr_matrix生成邻接矩阵
- 1805. 字符串中不同整数的数目
- MRO工业品企业采购系统:如何精细化采购协同管理?想要升级的工业品企业必看!
- Dark horse -- redis
- JDBC详解
- C # - realize serialization with Marshall class
- 10 schemes to ensure interface data security
- 【翻译】数字内幕。KubeCon + CloudNativeCon在2022年欧洲的选择过程
- Live broadcast today | the 2022 Hongji ecological partnership conference of "Renji collaboration has come" is ready to go
- 零基础入门PolarDB-X:搭建高可用系统并联动数据大屏
猜你喜欢

Detailed idea and code implementation of infix expression to suffix expression

LeetCode_双指针_中等_61. 旋转链表

【计算情与思】扫地僧、打字员、信息恐慌与奥本海默

接雨水问题解析

利用 clip-path 绘制不规则的图形

MySQL information schema learning (I) -- general table

JDBC details

保证接口数据安全的10种方案

MRO industrial products enterprise procurement system: how to refine procurement collaborative management? Industrial products enterprises that want to upgrade must see!

RT-Thread 组件 FinSH 使用时遇到的问题
随机推荐
Simple understanding of MySQL database
Problems encountered in using RT thread component fish
10 schemes to ensure interface data security
How to do smoke test
潇洒郎: AttributeError: partially initialized module ‘cv2‘ has no attribute ‘gapi_wip_gst_GStreamerPipe
Yyds dry goods inventory leetcode question set 751 - 760
[translation] micro survey of cloud native observation ability. Prometheus leads the trend, but there are still obstacles to understanding the health of the system
Php+redis realizes the function of canceling orders over time
理解 YOLOV1 第二篇 预测阶段 非极大值抑制(NMS)
Documents to be used in IC design process
史上超级详细,想找工作的你还不看这份资料就晚了
LeetCode-1279. 红绿灯路口
Swiftui game source code Encyclopedia of Snake game based on geometryreader and preference
Fast power template for inverse element, the role of inverse element and example [the 20th summer competition of Shanghai University Programming League] permutation counting
PMP practice once a day | don't get lost in the exam -7.6
IC设计流程中需要使用到的文件
[translation] supply chain security project in toto moved to CNCF incubator
受益匪浅,安卓面试问题
Countdown 2 days | live broadcast preview of Tencent cloud message queue data import platform
Unbalance balance (dynamic programming, DP)