ant-design-vue将table表格中的数字类型转换成文字

在这里插入图片描述
要判断男女,后端传过来的字段只有0和1,ant-design-vue提供了将表格中的数字类型转换成文字类型,代码如下:

columns : [
          {
    
    
            title: "姓名",
            dataIndex: "XM",
            key: "XM",
          },
          {
    
    
            title: "性别",
            dataIndex: "SEX",
            key: "SEX",
            customRender:function (text){
    
    
              if(text=='0'){
    
    
                return "男";
              }else{
    
    
                return "女";
              }
            }
          },
        ]

猜你喜欢

转载自blog.csdn.net/qq_45432996/article/details/108593992