赵士淞
2023-01-09 132368a17e7648523eb1684e37cd3a2d3f47e1ad
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 时间戳
     */