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

})

},

相关推荐
YUELEI11829 分钟前
vue3 使用sass变量
前端·css·sass
枣仁_1 小时前
大型语言模型(LLM)深度解析
前端·javascript·面试
程序员马晓博1 小时前
用上OpenManus啦,这玩意有点像...
前端
鱼樱前端1 小时前
36道我命由我不由天的JavaScript 基础面试题详解
前端·javascript·面试
嘉琪coder1 小时前
显示器报废,win笔记本远程连接mac mini4 3种方法实测
前端·windows·mac
hrrrrb2 小时前
【CSS3】筑基篇
前端·css·css3
boy快快长大2 小时前
【VUE】day01-vue基本使用、调试工具、指令与过滤器
前端·javascript·vue.js
三原2 小时前
五年使用vue2、vue3经验,我直接上手react
前端·javascript·react.js