zoukankan      html  css  js  c++  java
  • 接上篇 连接后台数据

    this.dataList 为后台返回的数据

    formatDate 为当前面板上的日期(42个)

    cellClassName: date => {
    默认返回的是标准时间 转换为常用日期格式
              let formatDate = date.getFullYear() + '-' + (((date.getMonth() + 1) >= 10 ? date.getMonth() + 1 : '0' + (date.getMonth() + 1))) + '-' + (date.getDate() >= 10 ? date.getDate() : '0' + date.getDate())
              let nowDate = new Date()
    获取当前时间
              let nowDateFormat = nowDate.getFullYear() + '-' + (((nowDate.getMonth() + 1) >= 10 ? nowDate.getMonth() + 1 : '0' + (nowDate.getMonth() + 1))) + '-' + (nowDate.getDate() >= 10 ? nowDate.getDate() : '0' + nowDate.getDate())
              将后台数据返回的时间和formatDate进行对比 取相同的添加样式 详细看findIndex
              let index = this.dataList.findIndex(item => item.date == formatDate)
              if (index == -1) return;
              if (formatDate >= nowDateFormat) return;
              return 'testClass' + this.dataList[index].data.status + ' testClass'
            }
    这样就将后台返回的状态添加给了对应的日期
  • 相关阅读:
    Java-笔记9-复习
    Java-笔记9
    Java-笔记8-复习
    Java0-笔记8
    Java-笔记7-复习
    hadoop-hdfs-ha配置-搭建
    Java-笔记7
    Java-笔记6-复习
    kettle-作业和参数
    kettle-脚本控件
  • 原文地址:https://www.cnblogs.com/Natural-numbers/p/14896855.html
Copyright © 2011-2022 走看看