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

})

},

相关推荐
秃头网友小李几秒前
前端难点:Vue3 响应式遇上 Three.js / ECharts —— 为什么要用 shallowRef?
前端·vue.js
梦曦i2 分钟前
Vite插件开发框架:14个实用插件与完整工具包
前端
KaMeidebaby3 分钟前
卡梅德生物技术快报|biotin 生物素标记抗体全流程
前端·人工智能·算法·数据挖掘·数据分析
VitoChang4 分钟前
前端也能快速入门后端! NestJS前台和后台的Auth认证
前端·后端
TheITSea5 分钟前
一、React初体验:搭建、解析现代开发环境
前端·react.js·前端框架
盒马盒马8 分钟前
Rust:String
java·前端·rust
程序猿阿伟11 分钟前
《Chrome非必要服务的精细化关闭指南》
前端·chrome·php
belong_my_offer13 分钟前
理解前端函数
前端
沐土Arvin23 分钟前
中国省市区json数据
前端
狗哥哥28 分钟前
统一下载网关技术方案
前端·架构