美文网首页
vue 时间分秒格式化

vue 时间分秒格式化

作者: 我是syq吖 | 来源:发表于2021-07-28 11:00 被阅读0次

毫秒转日期
main.js 中

Vue.filter('dataFormat', function(originValue) {
  const dt = new Date(originValue)
  const y = dt.getFullYear()
  const m = (dt.getMonth() + 1 + '').padStart(2, '0')
  const d = (dt.getDate() + '').padStart(2, '0')
  const hh = (dt.getHours() + '').padStart(2, '0')
  const mm = (dt.getMinutes() + '').padStart(2, '0')
  const ss = (dt.getSeconds() + '').padStart(2, '0')
  console.log(y)
  return `${y}-${m}-${d} ${hh}:${mm}:${ss} `
})

界面中

  {{scope.row.add_time|dataFormat}}

相关文章

  • vue 时间分秒格式化

    毫秒转日期main.js 中 界面中

  • 4.时间的处理,monent插件

    1.格式化时间 2.格式化年月日时分秒 3.通过获取当前时间的时间戳转化为年月日时分秒 4.某个时间时间戳转换成日...

  • js 时间格式化

    dateTime=====>要格式化的数据(包括:时间戳,年月日时分秒...) fmt===>要格式化的格式(y:...

  • eslint 自动格式化

    vue 保存自动eslint 格式化 自动格式化 Vue 相关 备用一(推荐) 备用二

  • 13、vue 中格式化时间

    过滤器格式化时间 date.js 格式化方法使用 vue中过滤器使用 v-model中格式化时间(过滤器就失效了)...

  • 格式化时间去除时分秒

  • vue时间格式化

    传入指定format格式没有则默认

  • vue 时间格式化

    1.函数封装 2.文件引入(注意:由于是函数,故名字要和函数的名字一致) 3.使用 (1)在过滤器中使用 (2)在...

  • Vue时间格式化

    1.html vue -- > {{date || dateString}} , 第二个为过滤器的名称。 可以再过...

  • js业务常用函数

    js来控制 字符串的长度! 去掉年月日时分秒 里的 时分秒! 根据时间差值 输出 倒计时的格式化 更加细则的判断数...

网友评论

      本文标题:vue 时间分秒格式化

      本文链接:https://www.haomeiwen.com/subject/nbgnsltx.html