a-table中columns的customRender属性

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" },
])

 也可以在表格上面自定义样式

  <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>

猜你喜欢

转载自blog.csdn.net/qq_46617584/article/details/131433328