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'
            }
    这样就将后台返回的状态添加给了对应的日期
  • 相关阅读:
    Git 基本使用
    vue cli 构建的 webpack 项目设置多页面
    vue父子组件通信
    路由 vue-router
    IE浏览器下 Vue2.x 和 Angular 应用无法打开
    点击组件外使组件隐藏
    vue2.x 随记
    python学习之路 二 :基本数据类型
    python学习之路 一 :编程语言介绍
    .net Timer定时执行
  • 原文地址:https://www.cnblogs.com/Natural-numbers/p/14896855.html
Copyright © 2011-2022 走看看