import { h } from 'vue'; import { Tag, Avatar } from 'ant-design-vue'; export const columns = [ { title: 'ID', dataIndex: 'id', fixed: 'left', width: 50, }, { title: '广告标题', dataIndex: 'title', width: 250, customRender({ record }) { return h( 'a', { href: record.url, target: '_blank', }, record.title, ); }, }, { title: '广告封面', dataIndex: 'cover', width: 100, customRender({ record }) { return h(Avatar, { size: 35, src: record.cover, shape: 'square', fit: 'fill', }); }, }, { title: '广告类型', dataIndex: 'type', width: 100, customRender({ record }) { let typeText = ''; switch (record.type) { case 1: typeText = '图片'; break; case 2: typeText = '文字'; break; case 3: typeText = '视频'; break; default: break; } return h('span', typeText || '-'); }, }, { title: '广告状态', dataIndex: 'status', width: 100, customRender({ record }) { return h( Tag, { color: record.status == 1 ? 'success' : 'error', }, { default: () => (record.status == 1 ? '正常' : '停用'), }, ); }, }, { title: '广告尺寸', dataIndex: 'size', width: 100, customRender({ record }) { return record.width + 'x' + record.height; }, }, { title: '投放时间', dataIndex: 'time', width: 180, customRender({ record }) { return record.startTime + '-' + record.endTime; }, }, { title: '点击量', dataIndex: 'click', width: 100, }, { title: '排序', dataIndex: 'sort', width: 100, }, { title: '创建人', dataIndex: 'createUser', width: 100, }, { title: '创建时间', dataIndex: 'createTime', width: 180, }, { title: '操作', fixed: 'right', dataIndex: 'action', key: 'action', width: 200, }, ];