[Original] Detailed explanation of the render method in the API of the antdesign table component column

I have been working on a project for the past two days. There is a backend interface. The returned data is numbers, but the frontend needs to display its Chinese value.

This is my first time contacting antdesign. I don’t know much about the table component, so let’s read the official documentation.

There is a render method in column, so try using it

 As shown below, the original code and front-end display

  {
    title: "状态",
    dataIndex: "meetingStatus",   
  },

Modified code and display

{
    title: "状态",
    dataIndex: "meetingStatus",
    key: "meetingStatus",
    render(meetingStatus){
      let config={
        '1':'预约中',
        '2':'未开始',
        '3':'进行中',
        '4':'已结束',
        '5':'预约失败',
      }
      return config[meetingStatus];
    }    
  },

Guess you like

Origin blog.csdn.net/yiran1919/article/details/130077114