vue2 后端传年月日 时分秒 前端拿到当日时间 做对比 如果是当日的时间 筛选出来

getList () {

this.loading = true

listAlarm(this.queryParams).then(response => {

this.listData = response.rows

const currentDate = new Date()

const year = currentDate.getFullYear()

const month = currentDate.getMonth() + 1 // 月份是从 0 开始计数的,所以需要加 1

const day = currentDate.getDate()

const formattedDate = `{year}-{month < 10 ? '0' + month : month}-${day < 10 ? '0' + day : day}`

console.log('我拿到当前的时间', formattedDate)

let arr = []

// let nowTimeDataList = []

this.listData.forEach(x => {

if (x.createTime.slice(0, 10) == formattedDate) {

arr.push(x.createTime.slice(0, 10))

this.nowTimeDataList.push(x)

}

})

console.log(11111, this.nowTimeDataList)

// this.total = response.total

// this.loading = false

})

},

相关推荐
这是个栗子5 分钟前
git报错:Reinitialized existing Git repository in ...
前端·git·github
ghfdgbg7 分钟前
15. Vue工程化 + ElementPlus
前端·javascript·vue.js
Onlyᝰ9 分钟前
前端使用jscpd查项目重复率
前端
pandarking18 分钟前
[CTF]攻防世界:web-unfinish(sql二次注入)
前端·数据库·sql·web安全·ctf
IT_陈寒18 分钟前
Java并发编程避坑指南:从volatile到ThreadLocal,8个实战案例解析线程安全核心原理
前端·人工智能·后端
ByteCraze23 分钟前
前端性能与监控指标采集系统设计方案
前端
山楂树の29 分钟前
前端实时渲染性能优化 使用cocoRLE编码进行图像传输并着色绘制
前端·图像处理·实时互动
程序员祥云30 分钟前
云希谷技术面
前端
一 乐36 分钟前
心理健康管理|基于springboot + vue心理健康管理系统(源码+数据库+文档)
java·开发语言·前端·数据库·vue.js·spring boot·后端
G***E31637 分钟前
重塑前端的力量:从界面承载到体验驱动的全链路能力进化
前端