实现方式一、
在data的columns中,通过scopedSlots渲染名叫type的插槽

 columns: [
       
        {
          title: '类型',
          dataIndex: 'CertificationType',
          scopedSlots: { customRender: 'type' },
        },
 
      ],

在a-table中

  <span slot="type" slot-scope="text,record">
          <span v-if="record.CertificationType==0">企业</span>
          <span v-else-if="record.CertificationType==1">个人</span>
          <span v-else-if="record.CertificationType==null">- -</span>
      </span>

实现方式二、
只需要在data的columns中通过customRender 进行三元表达式多个条件判断即可

  {
          title: '类型',
          dataIndex: 'CertificationType',
          customRender: (text, record, index) => text?(text == 0 ? '企业' : '个人'):'--',

        },

实现方式三、
columns: [

    {
      title: '类型',
      dataIndex: 'CertificationType',
      scopedSlots: { customRender: 'type' },
    },

  ],

在a-table中

   <span slot="type" slot-scope="text">{{ auditState[text] }}</span>
  在data中
      auditState:{
         0: "企业",
         1: "个人",  
         2"--"
      },
Logo

前往低代码交流专区

更多推荐