import { h } from 'vue';
import { ElAvatar } from 'element-plus';
export const columns = [
  {
    type: 'selection',
  },
  {
    label: 'ID',
    prop: 'id'
  },
  {
    label: '广告标题',
    prop: 'title',
    render(record) {
      return h('a', {
        href: 'http://www.baidu.com',
        target:"_blank"
      },record.row.title);
    },
  },
  {
    label: '广告封面',
    prop: 'cover',
    render(record) {
      return h(ElAvatar, {
        size: 48,
        src: record.row.cover,
        shape: 'square',
        fit: 'fill',
      });
    },
    width: 100,
  },
  {
    label: '广告类型',
    prop: 'type',
    render(record) {
      let typeText = ''
      switch (record.row.type) {
        case 1:
          typeText='图片'
          break;
        case 2:
          typeText='文字'
          break;
        case 3:
          typeText='视频'
          break;
        default:
          break;
      }
      return h('span', typeText || '-');
    },
  },
  {
    label: '广告状态',
    prop: 'status',
    render(record) {
      return h('span', record.row.status === 1 ? '在用' : '停用')
    },
  },
  {
    label: '创建人',
    prop: 'createUser',
  },
  {
    label: '创建时间',
    prop: 'createTime',
  },
];
