方法就是一种变量

const tmpTotime = function (tmp) {
  const t = function (i) {
    return i < 10 ? '0' + i : i
  }
  const date = new Date(tmp * 1000)
  const Y = date.getFullYear() + '-'
  const M = t(date.getMonth() + 1) + '-'
  const D = t(date.getDate()) + ' '
  const h = t(date.getHours()) + ':'
  const m = t(date.getMinutes()) + ':'
  const s = t(date.getSeconds())
  return Y + M + D + h + m + s
}





const makesSign = () => { const API_SECRET_KEY = 'https://github.com/dyq086/wepy-mall/tree/master/src' const TIMESTAMP = 'qq' const SIGN ='123' return { 'API_SECRET_KEY': API_SECRET_KEY, 'TIMESTAMP': TIMESTAMP, 'SIGN': SIGN } } makesSign().TIMESTAMP




原文地址:https://www.cnblogs.com/rsapaper/p/9595668.html