element table,表格参数格式化formatter

<el-table-column
  prop="sex"
  label="性别"
  width="180"
  :formatter="formatSex"
>

formatSex: function (row, column) {
  return row.sex === 1 ? '男' : row.sex === 0 ? '女' : '未知'
}

或者多个的话
formatMsgType:
function (row, column) { switch (row.msgType) { case ("text"): return '文本'; break; case ("image"): return '图片'; break; case ("voice"): return '语音'; break; case ("video"): return '视频'; break; case ("shortvideo"): return '小视频'; break; case ("location"): return '地理位置'; break; case ("link"): return '链接消息'; break; } },

 

posted @ 2020-08-24 15:42  Sea。  阅读(3961)  评论(0编辑  收藏  举报