ant-design-vue converts the number type in the table into text

Insert picture description here
To judge men and women, the only fields passed from the back end are 0 and 1. Ant-design-vue provides the option to convert the number type in the table into a text type. The code is as follows:

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

Guess you like

Origin blog.csdn.net/qq_45432996/article/details/108593992