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

})

},

相关推荐
西陵1 天前
Nx带来极致的前端开发体验——任务缓存
前端·javascript·架构
10年前端老司机1 天前
Promise 常见面试题(持续更新中)
前端·javascript
潘小安1 天前
跟着 AI 学 (一)- shell 脚本
前端·ci/cd·vibecoding
clownAdam1 天前
Chrome性能优化秘籍
前端·chrome·性能优化
@Kerry~1 天前
phpstudy .htaccess 文件内容
java·开发语言·前端
@PHARAOH1 天前
WHAT - 前端性能指标(交互和响应性能指标)
前端·交互
噢,我明白了1 天前
前端js 常见算法面试题目详解
前端·javascript·算法
im_AMBER1 天前
Web 开发 30
前端·笔记·后端·学习·web
Jonathan Star1 天前
Webpack 打包优化与骨架屏结合:双管齐下提升前端性能与用户体验
前端·webpack·ux
做好一个小前端1 天前
后端接口获取到csv格式内容并导出,拒绝乱码
前端·javascript·html