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

})

},

相关推荐
lichenyang45324 分钟前
从 0 新增一个 `has.echo`:我如何理解小程序容器里的 API 调用链路
前端
leptune1 小时前
Mac 使用 Microsoft Word 批量将 DOCX 转 PDF(保持原排版)
前端
大龄秃头程序员1 小时前
Flutter 长列表 1 万条滑动卡顿治理:Baseline vs Optimized 可跑 Demo
前端
yingyima1 小时前
Git 核心命令速查:掌握底层原理与实战技巧
前端
黄林晴1 小时前
Kuikly 是什么?和KMP有什么关系?
android·前端
HokKeung1 小时前
Git Hooks 和 Husky 怎么选
前端·前端工程化
李明卫杭州1 小时前
Vue 3 响应式三剑客:ref、shallowRef、reactive,你真的用对了吗?
前端
触底反弹1 小时前
🔥 JavaScript this 指向全解析:面试必考的 5 大绑定规则
前端·javascript·面试
Csvn2 小时前
TypeScript 类型守卫的 4 个实战级别:从 `filter(Boolean)` 到自定义类型谓词
前端
骑士雄师2 小时前
langchain:推荐切片策略
服务器·前端·langchain