当前位置:网站首页>列表加入计时器(正计时、倒计时)
列表加入计时器(正计时、倒计时)
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)
})
}列表每一行都有独立计时!!!
边栏推荐
猜你喜欢

SQL calculates daily new users and retention rate indicators

牛津大學教授Michael Wooldridge:AI社區近40年如何看待神經網絡

释放互联网价值的 Web3

3D可旋转粒子矩阵

OpenHarmony—内核对象事件之源码详解

Analysis of the core components of mybayis

SQL interview question: find the maximum number of consecutive login days

Steam education to break the barriers between disciplines

Graduation project - Design and development of restaurant management game based on unity (with source code, opening report, thesis, defense PPT, demonstration video and database)

try except 添加辅助新列
随机推荐
闭包的理解
《数字经济全景白皮书》消费金融数字化篇 重磅发布
Brief introduction to mongodb working principle of mongodb series
SQL Server2019 新建 SQL Server身份验证用户名 并登录
SQL interview question: find the maximum number of consecutive login days
About Critical Values
devpi
OpenHarmony—内核对象事件之源码详解
百度时间因子添加
道路千万条,为什么这家创新存储公司会选这条?
Show the actual work case of creating intermediate data table with SQL
匿名函数this指向以及变量提升
An in-depth analysis of the election mechanism in kubernetes
ANR Application Not Responding
Win11底部状态栏如何换成黑色?Win11底部状态栏换黑色的方法
找出连续7天登陆,连续30天登陆的用户
sql计算每日新增用户、及留存率指标
Modular operation
应用实践 | 10 亿数据秒级关联,货拉拉基于 Apache Doris 的 OLAP 体系演进(附 PPT 下载)
获取当前日期0点及23点59时间戳