The customRender attribute of columns in a-table

const columns = ref([
 {
        title: "序号",
        dataIndex: "index",
        key: "index",
        align: "center",
    },
  {
        title: "处理开始时间",
        dataIndex: "executeStart",
        ellipsis: true,
        // width: 240,
        customRender: ({ text, record, index, column }) => {
            if (!record.lastModificationTime) {
                return dayjs(text).format("YYYY-MM-DD HH:mm:ss");
            } else {
                return dayjs(record.lastModificationTime).format("YYYY-MM-DD HH:mm:ss");
            }
        },
    },
 { title: "操作", dataIndex: "operation", key: "operation", align: "center" },
])

 You can also customize the style on the table

  <template #bodyCell="{ column, record, index }">
        <template v-if="column.key === 'operation'">
          <span>
            <a
              @click="editEvent('download', record)"
              v-if="operatingButton?.reportdownload"
            >
              报表下载</a
            >
            <a-divider type="vertical" v-if="dividerbutton?.reportdownload" />
          </span>
        </template>
        <template v-if="column.key === 'index'">
          <span>{
   
   {
            `${
              (objArray.pagination.current - 1) * objArray.pagination.pageSize +
              index +
              1
            }`
          }}</span>
        </template>
 </template>

Guess you like

Origin blog.csdn.net/qq_46617584/article/details/131433328