当前位置:网站首页>列表加入计时器(正计时、倒计时)
列表加入计时器(正计时、倒计时)
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)
})
}列表每一行都有独立计时!!!
边栏推荐
- 数字化转型的1个目标,3大领域,6大因素和9个环节
- leetcode 1647. Minimum deletions to make character frequencies unique
- 进阶高级-业务事务设计 开发入门
- 业务层修改--根据现有框架的反推修改
- math_证明常用等价无穷小&案例&代换
- Professor Michael Wooldridge of Oxford University: how the AI community views neural networks in the past 40 years
- An in-depth analysis of the election mechanism in kubernetes
- devpi
- 释放互联网价值的 Web3
- 泰山OFFICE技术讲座:WORD奇怪的字体高度
猜你喜欢

leetcode 1423. Maximum points you can obtain from cards

Sound network releases lingfalcon Internet of things cloud platform, which can build sample scenarios in one hour

Openharmony - detailed source code of Kernel Object Events

About Statistical Distributions

math_ Proving common equivalent infinitesimal & Case & substitution

模块化操作

Qt 中 QObjectCleanupHandler 使用总结

About Critical Values

Jenkins Pipeline 对Job参数的处理

new String(“hello“)之后,到底创建了几个对象?
随机推荐
应用实践 | 10 亿数据秒级关联,货拉拉基于 Apache Doris 的 OLAP 体系演进(附 PPT 下载)
sql计算每日新增用户、及留存率指标
Cvpr2022 | Zhejiang University and ant group put forward a hierarchical residual multi granularity classification network based on label relation tree to model hierarchical knowledge among multi granu
First day of new work
Collection of real test questions
About covariance and correlation
进阶高级-业务事务设计 开发入门
async-validator.js数据校验器
G 双轴图sql脚本
Baidu time factor addition
Graduation project - Design and development of restaurant management game based on unity (with source code, opening report, thesis, defense PPT, demonstration video and database)
微信小程序接入百度统计报错 Cannot read property ‘mtj‘ of undefined
Cross cluster deployment of helm applications using karmada
rancher增加/删除node节点
Tensorboard Usage Summary
grafana绘制走势图
声网发布灵隼物联网云平台 可一小时构建示例场景
Win11如何给系统盘瘦身?Win11系统盘瘦身方法
[C #] explain the difference between value type and reference type
An in-depth analysis of the election mechanism in kubernetes