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

})

},

相关推荐
Setsuna_F_Seiei1 小时前
前端的 AI 学习之路 01 之 Agent API 调用 - 和 Agent 的基础对话
前端·人工智能·ai编程
threerocks2 小时前
AI 原生软件开发生命周期手册 - 如何借助 AI,逐阶段改造软件开发生命周期
前端·javascript·后端
徐小夕2 小时前
3分钟从想法到Agent上线:我们开源了一款AI可视化工作流“IDE”
前端·算法·github
why技术4 小时前
eli5,我觉得这个全网在吹的技能,使用体验真的很一般啊。
前端·人工智能·后端
excel4 小时前
记录升级 nuxt3 到 nuxt4 记录
前端
剑胆琴心静水深流4 小时前
全栈之路6---web集成与呈现
前端·vue.js·spring boot·分布式·spring·前端框架·npm
前端snow4 小时前
ai agent -- Memory汇总
前端
ITresearchGuest5 小时前
AI 焦虑下,前端该何去何从
前端·人工智能
Codiggerworld5 小时前
Chrome DevTools 隐藏神技:这 5 个调试技巧你可能从来没用过
前端·chrome·chrome devtools
旋生万物5 小时前
【终极实战】用Python从零“生成“一个宇宙:螺旋干涉模型的代码实现
开发语言·前端·人工智能·react.js·php·wpf