学无先后,达者为师

网站首页 编程语言 正文

el-table-column 表单table的后端返回时间戳的转换

作者:农夫三拳有点疼=-= 更新时间: 2023-10-17 编程语言
<el-table-column prop="releaseDate" label="结算时间" align="left" :formatter="dateFormat">
</el-table-column>

方法
dateFormat(row, column,cellValue,index) {
      let date = new Date(parseInt(cellValue));
      if(isNaN(date)) return '--'
      let Y = date.getFullYear() + '-';
      let M = date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) + '-' : date.getMonth() + 1 + '-';
      let D = date.getDate() < 10 ? '0' + date.getDate() + ' ' : date.getDate() + ' ';
    /* let h = date.getHours() < 10 ? '0' + date.getHours() + ':' : date.getHours() + ':';
      let m = date.getMinutes()  < 10 ? '0' + date.getMinutes() + ':' : date.getMinutes() + ':';
      let s = date.getSeconds() < 10 ? '0' + date.getSeconds() : date.getSeconds();*/
      return Y + M + D ;/*+ h + m + s;*///不要 时分秒
    },

原文链接:https://blog.csdn.net/m0_64207574/article/details/130942668

  • 上一篇:没有了
  • 下一篇:没有了
栏目分类
最近更新