欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

element-ui 表格數(shù)據(jù)時(shí)間格式化的方法

 更新時(shí)間:2018年08月24日 10:27:46   作者:小馬哥的天涯  
這篇文章主要介紹了element-ui 表格數(shù)據(jù)時(shí)間格式化的方法,小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,也給大家做個(gè)參考。一起跟隨小編過來看看吧

后臺返回時(shí)間格式  /1470220594000/

在element-ui  table 如何格式化呢 

1.首先

復(fù)制代碼 代碼如下:
<el-table-column prop="AuditEndTime" label="處理時(shí)間" width="120" :formatter="dateFormat" align="center"></el-table-column>
 

主要是:formatter="dateFormat" 這個(gè)屬性 

formatter 用來格式化內(nèi)容 Function(row, column, cellValue, index)  

然后在   methods 方法對象里  添加 如下方法

//時(shí)間格式化
      dateFormat(row, column, cellValue, index){
          const daterc = row[column.property]
          if(daterc!=null){
            const dateMat= new Date(parseInt(daterc.replace("/Date(", "").replace(")/", ""), 10));
           const year = dateMat.getFullYear();
          const month = dateMat.getMonth() + 1;
          const day = dateMat.getDate();
          const hh = dateMat.getHours();
          const mm = dateMat.getMinutes();
          const ss = dateMat.getSeconds();
          const timeFormat= year + "/" + month + "/" + day + " " + hh + ":" + mm + ":" + ss;
          return timeFormat;
          }
          
      }

格式化后:

2018/2/27 8:59:19

PS:Element UI的表格table列的寬度自適應(yīng)設(shè)置

不要設(shè)置  width="110px"

<el-table-column prop="login_id" align="center" label="工號"> </el-table-column>

<el-table-column prop="login_id" width="110px" align="center" label="工號"> </el-table-column>

以上就是本文的全部內(nèi)容,希望對大家的學(xué)習(xí)有所幫助,也希望大家多多支持腳本之家。

相關(guān)文章

最新評論