后臺返回時間格式 /1470220594000/
在element-ui table 如何格式化呢
1.首先
主要是:formatter="dateFormat" 這個屬性
formatter 用來格式化內(nèi)容 Function(row, column, cellValue, index)
然后在 methods 方法對象里 添加 如下方法
//時間格式化 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í)有所幫助,也希望大家多多支持武林網(wǎng)。
新聞熱點
疑難解答