场景
数据库中存储的是int型的1和0。
从数据中取出来的也是1和0。
怎样将其格式化为男和女
实现
//table 表格
<el-table>
<el-table-column prop="type" label="案件类型" :formatter="sfktFormate"></el-table-column>
</el-table>
添加formatter属性对应的sfktFormate是一个方法
//table表格格式化
sfktFormate(row,index){
if (row.type == 1) {
return "男";
} else if(row.type == 0){
return "女";
}
}