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

})

},

相关推荐
PBitW18 小时前
一个skill,让项目管理和写绩效变得简单!
前端·trae
Dxy123931021618 小时前
CSS中的filter属性详解
前端·css
Vincent_czr18 小时前
iOS中常常遇到后端返回JSON出现null值问题
前端
问心无愧051318 小时前
ctf show web入门90
前端·笔记
yingyima18 小时前
午夜惊魂:用 Shell 脚本和 Hey Cron 解决服务器定时报警
前端
青山Coding18 小时前
Cesium应用(五):通视分析,解锁三维场景的”无遮挡“视野
前端·cesium
JavaAgent架构师18 小时前
前端AI工程化(三):异步编程与并发控制
前端·人工智能
独泪了无痕18 小时前
利用vue-pdf-embed实现PDF文件的预览
前端·vue.js
Exploring19 小时前
Hola 计算器 v1.0.1 发布:个税计算全面升级,劳务报酬也能算清楚了!
前端