一、男 or 女or null 的显示
在数据当中我们把gender设置为tinyint类型,使用01来对性别进行判断,但是我在使用时遇到一个问题,就是我后台假如没有性别怎么办?
请看代码:
<el-table-column algin="center" laber="性别">
<template slot-scope="scope">//当gender为0渲染男,为1渲染女,0和1都不满足就渲染空字符串
<span style="margin-right: 10px;">{{ scope.row.gender == "0" ? "男" : scope.row.gender == "1" ? "女" : ""}}</span>
</template>
</el-table-column>