当前位置:网站首页>列表加入计时器(正计时、倒计时)
列表加入计时器(正计时、倒计时)
2022-06-28 19:01:00 【天高任鸟飞dyz(前端)】
// 获取列表
onload() {
getList().then(res => {
this.tableData = res.data.data.records;
// 计时器
this.tableData.forEach(el=>{
el.excessTime = Date.now(); // 初始时间值
this.isTimingcheng(el); // 每项挂载定时器
})
});
}
// 计时器
isTimingcheng(row) {
if (判断条件何时将计时器清掉) {
row.countDown = setInterval(() => {
row.excessTime = row.excessTime + 1000;
this.$forceUpdate(); // 每次更新刷新dom
}, 1000);
} else {
clearInterval(row.countDown); // 清空定时器
}
}
// 清除所有计时器
clearAll(list){
list.forEach(el=>{
clearInterval(el.countDown)
})
}列表每一行都有独立计时!!!
边栏推荐
- About Covariance and Correlation(协方差和相关)
- leetcode 1423. Maximum points you can obtain from cards
- new String(“hello“)之后,到底创建了几个对象?
- How many objects are created after new string ("hello")?
- C语言文件操作
- Upward and downward transformation
- 让企业数字化砸锅和IT主管背锅的软件供应链安全风险指南
- 内核错误怎么解决?Win11系统内核错误解决方法
- Brief introduction to mongodb working principle of mongodb series
- C# 41. Int to string
猜你喜欢
随机推荐
19.2 container classification, array and vector container refinement
Find out the users who log in for 7 consecutive days and 30 consecutive days
First day of new work
About Critical Values
Rxjs map, mergeMap 和 switchMap 的区别和联系
3D rotatable particle matrix
Shell脚本批量修改文件目录权限
About Statistical Distributions
Understanding of closures
idea其他分支合并到dev分支
async-validator. JS data verifier
Try except add auxiliary new column
FFmpeg学习总结
About Significance Tests
Get the timestamp of 0:00 and 23:59 of the current date
请问下flinkcdc用flinksql提交的话只能一个表提交一个任务吗?那有几千张表的时候还能这么
【Unity3D】相机跟随
华为云OneMeeting告诉你全场景会议这么开!
原生实现.NET5.0+ 自定义日志
Friends from Fujian, your old-age insurance is on the cloud!







![[unity3d] camera follow](/img/11/6309450f2b3ef33df558104549dc4c.png)

