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

})

},

相关推荐
天天进步201533 分钟前
CSS Grid与Flexbox:2025年响应式布局终极指南
前端·css
Boop_wu1 小时前
[Java EE] 计算机基础
java·服务器·前端
Novlan12 小时前
TDesign UniApp 组件库来了
前端
用户47949283569152 小时前
React DevTools 组件名乱码?揭秘从开发到生产的代码变形记
前端·react.js
顾安r2 小时前
11.8 脚本网页 打砖块max
服务器·前端·html·css3
倚栏听风雨2 小时前
typescript 方法前面加* 是什么意思
前端
狮子不白3 小时前
C#WEB 防重复提交控制
开发语言·前端·程序人生·c#
菜鸟‍3 小时前
【前端学习】阿里前端面试题
前端·javascript·学习
Jonathan Star3 小时前
LangFlow前端源码深度解析:核心模块与关键实现
前端
用户47949283569153 小时前
告别span嵌套地狱:CSS Highlights API重新定义语法高亮
前端·javascript·css