• 接上篇 连接后台数据


    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'
            }
    这样就将后台返回的状态添加给了对应的日期
  • 相关阅读:
    剑指 Offer 25. 合并两个排序的链表
    53. 最大子序和 动态规划
    121. 买卖股票的最佳时机
    20. 有效的括号
    centos7 常用操作
    树莓派
    golang 学习笔记
    并发 线程 进程
    连接内网问题
    Lamp 高并发优化
  • 原文地址:https://www.cnblogs.com/Natural-numbers/p/14896855.html
Copyright © 2020-2023  润新知