赵士淞
2023-01-09 d837263f2438ed70a256912ac0b329c5ae0eea14
eladmin-web-master/src/components/Crud/crud.js
@@ -531,6 +531,20 @@
      })
    },
    /**
     * 年月格式化
     * @param {Object} timestamp 时间戳
     */
    toMonth(timestamp) {
      if (timestamp == null) {
        return
      } else {
        const system = new Date(timestamp)
        const year = system.getFullYear()
        const month = system.getMonth() + 1 < 10 ? '0' + (system.getMonth() + 1) : system.getMonth() + 1
        return year + '-' + month
      }
    },
    /**
     * 日期格式化
     * @param {Object} timestamp 时间戳
     */