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

})

},

相关推荐
张风捷特烈26 分钟前
状态管理大乱斗#03 | Provider 源码全面评析
android·前端·flutter
灵感__idea6 小时前
Hello 算法:“走一步看一步”的智慧
前端·javascript·算法
吴文周8 小时前
告别重复劳动:一套插件让 AI 替你写代码、修Bug、做测试、上生产
前端·后端·ai编程
Mh8 小时前
我决定写一个 3D 地球仪来记录下我要去的地方
前端·javascript·动效
yaoxin5211238 小时前
390. Java IO API - WatchDir 示例
java·前端·python
懒狗小前端8 小时前
做了一个 codex 的中文文档网站,做的不好可以随便喷
前端·后端
. . . . .10 小时前
ref、useRef 和 forwardRef
前端·javascript·react.js
energy_DT10 小时前
2026年海上钻井平台数字孪生平台:引领海洋能源数字化转型
前端
Eric_见嘉10 小时前
在职前端 Agent 配置分享
前端·后端·agent
柚子81610 小时前
break跳出语句块的神奇技巧
前端·javascript