import { h } from 'vue';
import { ElTag } from 'element-plus';

export const columns2 = [
  {
    label: '标题',
    prop: 'title',
    width: 300,
  },
  {
    label: '类型',
    prop: 'type',
    // render(record) {
    //   return h('span', record.row.type === 1 ? '通知' : '公告');
    // },
    render(record) {
      return h(
        ElTag,
        {
          type: record.row.type == 1 ? 'primary' : 'warning',
        },
        {
          default: () => (record.row.type == 1 ? '通知' : '公告'),
        },
      );
    },
  },
  {
    label: '状态',
    prop: 'status',
    // render(record) {
    //   return h('span', record.row.status === 1 ? '正常' : '关闭')
    // },
    render(record) {
      return h(
        ElTag,
        {
          type: record.row.status ==1 ? 'success' : 'danger',
        },
        {
          default: () => (record.row.status ==1 ? '正常' : '禁用'),
        },
      );
    },
  },
  {
    label: '点击率',
    prop: 'clickNum',
  },
  {
    label: '创建人',
    prop: 'createUser',
  },
  {
    label: '创建时间',
    prop: 'createTime',
    width: 180,
  },
];
