【原创】antdesign表格组件column的API里render方法详解

这两天做项目,有一个后台的接口,返回的数据为数字,但是前台要展示它的中文值

第一次接触antdesign,对于table组件还不是很了解,那就啃官方文档吧

在column里有个render方法,那就用它试试

 如下图,原始代码及前台展示

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

修改后的代码及展示

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

扫描二维码关注公众号,回复: 17260626 查看本文章

猜你喜欢

转载自blog.csdn.net/yiran1919/article/details/130077114