element表格formatter數據格式化

將數字轉化漢字

fomatter (row, column, cellValue, index) {
 if (row.stus === 0) {
        row.stus = '啓用'
    } else if (row.stus === 1){
        row.stus = '禁用'
    }
    if (row.cotType === 0) {
        row.cotType = '有線'
    } else if (row.cotType === 1){
        row.cotType = '無線'
    }
    return cellValue
},

日期格式化

//  後臺返回格式:2020-04-02T07:05:33.000+0000
//  轉化爲 2020-4-2

fomatter (row, column, cellValue, index) {
   if (column.property == 'createDate')  {
        return new Date(cellValue).getFullYear() + ' - ' + (new Date(cellValue).getMonth() + 1) + ' - ' + new Date(cellValue).getDate()
    } else {
        return cellValue
    }
},
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章