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

})

},

相关推荐
ssshooter11 分钟前
小程序分包页面报 "has not been registered yet" 的隐蔽根因:一个动态 import 拖垮整个分包
前端·javascript·微信小程序
鹏多多32 分钟前
Web浏览器后台离线通知方案实现以及兼容指南
前端·javascript·vue.js
yangmu320334 分钟前
Vue3 响应式系统深度解析:从 Proxy 到依赖追踪
前端·javascript·vue.js
还有多久拿退休金43 分钟前
AI 写了代码,谁替你"试毒"?
前端·架构·ai编程
大E帝国子民144 分钟前
OpenCloudOS Server 9 安装 Nginx 完整指南
前端·网络·nginx
少年白马醉春风丶1 小时前
【AI Agent面试题】Agent 的自主性分级,怎么理解?
前端
yingyima1 小时前
Docker Compose 紧急救援:凌晨3点服务器报警的解决方案
前端
石小石Orz2 小时前
星云SDK + 油猴:给LLM塑造肉身,陪伴你在每个网页
前端·人工智能
2601_963771372 小时前
10 Best PHP Media CMS and Scripts for Web Creators in 2026
开发语言·前端·php
VaJoy2 小时前
全面革新⚡️ Vue 3.6 项目工程的基础实现
前端·vue.js