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

})

},

相关推荐
王大师王文峰10 小时前
HTML 入门到进阶:语义化标签、表单与多媒体一篇打通【语义化布局、表单校验、video/audio、Canvas、无障碍与 SEO】
前端·css·node.js·html·css3·jquery·html5
风骏时光牛马10 小时前
AI_Coding:智能代码创作助手
前端
剪刀石头布啊19 小时前
vue-react为何要虚拟dom
前端
剪刀石头布啊19 小时前
ahooks常用的一些库,我们使用一下
前端
剪刀石头布啊19 小时前
从git更新本地提交记录到更新已经推送到远端记录
前端
Flynt21 小时前
axios 被投毒半年后,我把 npm 的"安全防线"实测了一遍:最信任的 SHA512 是安慰剂
前端·npm·node.js
excel1 天前
Base62 和 Base64 有什么区别?
前端
风骏时光牛马1 天前
大模型底层架构与AI源码深度剖析
前端
掘金挖土1 天前
前端手摸手跑路之 AI 应用开发(九)
前端·后端