How to use the numeral.prototype function in numeral

To help you get started, we’ve selected a few numeral examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github proxyee-down-org / proxyee-down / front / src / main.js View on Github external
error.response.data.code
      Vue.prototype.$Message.error(i18n.t(i18nKey))
    } else if (error.response.status == 404) {
      Vue.prototype.$Message.error(i18n.t('alert.notFound'))
    } else if (error.response.status == 504) {
      Vue.prototype.$Message.error(i18n.t('alert.timeout'))
    } else {
      Vue.prototype.$Message.error(i18n.t('alert.error'))
    }
    return Promise.reject(error)
  }
)

//去除字节大小格式化后的i字符
const format = numeral.prototype.constructor.fn.format
numeral.prototype.constructor.fn.format = function(fmt) {
  let result = format.call(this, fmt)
  if (/^.*ib$/.test(fmt)) {
    result = result.replace('i', '')
  }
  return result
}
Vue.prototype.$numeral = numeral

Date.prototype.format = function(fmt) {
  var o = {
    'M+': this.getMonth() + 1, // Month
    'd+': this.getDate(), // Day
    'h+': this.getHours(), // Hour
    'm+': this.getMinutes(), // Minute
    's+': this.getSeconds(), // Second
    'q+': Math.floor((this.getMonth() + 3) / 3), // Quarter
github proxyee-down-org / proxyee-down / front / src / main.js View on Github external
'.' +
        error.response.data.code
      Vue.prototype.$Message.error(i18n.t(i18nKey))
    } else if (error.response.status == 404) {
      Vue.prototype.$Message.error(i18n.t('alert.notFound'))
    } else if (error.response.status == 504) {
      Vue.prototype.$Message.error(i18n.t('alert.timeout'))
    } else {
      Vue.prototype.$Message.error(i18n.t('alert.error'))
    }
    return Promise.reject(error)
  }
)

//去除字节大小格式化后的i字符
const format = numeral.prototype.constructor.fn.format
numeral.prototype.constructor.fn.format = function(fmt) {
  let result = format.call(this, fmt)
  if (/^.*ib$/.test(fmt)) {
    result = result.replace('i', '')
  }
  return result
}
Vue.prototype.$numeral = numeral

Date.prototype.format = function(fmt) {
  var o = {
    'M+': this.getMonth() + 1, // Month
    'd+': this.getDate(), // Day
    'h+': this.getHours(), // Hour
    'm+': this.getMinutes(), // Minute
    's+': this.getSeconds(), // Second