{"size": 915, "ext": "js", "max_stars_repo_path": "src/assets/js/common.js", "max_stars_repo_name": "Guoch0526/webpack-single-app", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "src/assets/js/common.js", "max_issues_repo_name": "Guoch0526/webpack-single-app", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "src/assets/js/common.js", "max_forks_repo_name": "Guoch0526/webpack-single-app", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 21.2790697674, "max_line_length": 47, "alphanum_fraction": 0.5519125683}
var Document = {
  // 修改文档标题
  changeTitle (title = '淘力') {
    document.title = title
    var i = document.createElement('iframe')
    // i.src = '/static/favicon.ico'
    i.style.display = 'none'
    i.onload = function () {
      setTimeout(() => {
        i.remove()
      }, 5)
    }
    document.body.appendChild(i)
  },
  // 设置背景颜色
  setBackgroundColor (color) {
    document.body.style.backgroundColor = color
  },
  // 解析时间戳
  getTime (time) {
    const date = new Date(time)
    const obj = {}
    function zero (str) {
      str = str + ''
      if (str.length === 1) {
        str = `0${str}`
      }
      return str
    }
    obj.year = date.getFullYear() + ''
    obj.month = zero(date.getMonth() + 1)
    obj.day = zero(date.getDate())
    obj.hour = zero(date.getHours())
    obj.minute = zero(date.getMinutes())
    obj.second = zero(date.getSeconds())
    return obj
  }
}

export {
  Document
}
