例如table中有个deptType,返回的值是0,1,2,3 等。要根据0,1,2,3替换成对应的文字。如何操作?<el-table ref="multipleTable" :data="tabledData" border style="width:100%" :row-class-name="tableRowClassName" @selection-change="handleSelectionChange" @row-dblclick="dbclick" @select="selectRow" class="tableClass" :header-cell-style="headerRowClass"> <el-table-column type="selection" width="55"></el-table-column> <el-table-column prop="deptId" label="机构编码"></el-table-column> <el-table-column prop="deptName" label="机构名称"></el-table-column> <el-table-column prop="deptType" label="机构类型"></el-table-column> <el-table-column prop="orderNum" label="排序"></el-table-column> <el-table-column prop="leader" label="负责人"></el-table-column> <el-table-column prop="phone" label="联系电话"></el-table-column> <el-table-column prop="email" label="邮箱"></el-table-column> <el-table-column prop="deptLogo" label="Logo"></el-table-column> <el-table-column prop="remark" label="备注"></el-table-column></el-table>
1 回答
皈依舞
TA贡献1851条经验 获得超3个赞
使用Scoped slot
//mfunc是你的转换函数,或者使用filter
<el-table-column prop="deptType" label="机构类型">
<template slot-scope="scope">
<span>{{ mfunc(scope.row.deptType) }}</span>
</template>
</el-table-column>
methods: {
mfunc(num){
let result = num
switch(num){
case 0: result = 'a';break;
...
}
return result
}
}
添加回答
举报
0/150
提交
取消