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

})

},

相关推荐
变与不变8064 小时前
jQuery怎么使用
前端·javascript
神膘护体小月半4 小时前
flex 布局的 order 属性
前端·css
paopaokaka_luck4 小时前
流浪动物救助与收养系统(DeepSeek AI对话、 ECharts多维分析、救助流程衔接、领养与回访衔接、 捐赠确认与公示、志愿者协作)
java·前端·javascript·人工智能·mysql·echarts·推荐算法
仰望.4 小时前
vue 表格组件 vxe-table 树表格懒加载支持拖拽排序的详细用法
前端·javascript·vue.js·vxe-table
前端 贾公子4 小时前
vite-plugin-uni-manifest 升级指南
前端
小码哥_常4 小时前
iPhone 用户传了张 HEIC,我的前端崩了
前端
小码哥_常4 小时前
你发的原图可能暴露你家地址——聊聊图片 EXIF 隐私
前端
java1234_小锋5 小时前
【技术专题】CSS3 网页技术 - CSS3 优先级
前端·css·css3
鸿蒙开发6 小时前
共享 Schema 与 SchemaFactory
前端·后端·harmonyos
屏什么录6 小时前
录屏超过两小时就卡顿崩盘?从参数调优到代码实现,一文彻底搞定长时间录屏
前端·音视频开发